Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

"The associated script cannot be loaded."

$
0
0
Hi everyone, I'm not sure if this is the right place to post this, please tell me if it's wrong. I'm still a beginner at using Unity, and an error keeps showing up when I try to put a script on a character. "The associated script cannot be loaded. Please fix any compile errors and assign a valid script." I don't think there are errors in the script but its still giving me this error when I try to test out the game by pressing play. It also never lets me drag the code onto the character because "The script class cannot be found". I will paste the code below this. Can someone please help? Thanks using System.Collections; using System.Collections.Generic; using UnityEngine; public class Movement : MonoBehaviour { Rigidbody2D rigidbody2d; SpriteRenderer spriterenderer; // Start is called before the first frame update void Start() { rigidbody2d = GetComponent(); spriterenderer = GetComponent(); } private void FixedUpdate() { if (Input.GetKey("a")) rigidbody2d.velocity = new Vector2(-2, 0); else if(Input.GetKey("d")) rigidbody2d.velocity = new Vector2(2, 0); } } [1]: /storage/temp/139447-screenshot-121.png ![alt text][1] Here are the errors in unity if it helps

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>