"The associated script cannot be loaded."
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<Rigidbody2D>();
spriterenderer = GetComponent<SpriteRenderer>();
}
private void FixedUpdate()
{
if (Input.GetKey("a"))
rigidbody2d.velocity = new Vector2(-2, 0);
else if(Input.GetKey("d"))
rigidbody2d.velocity = new Vector2(2, 0);
}
}
Here are the errors in unity if it helps