Does not contain a class derived from UnityEngine.MonoBehaviour

I am going through the course again because I had to be gone for quite a long time and I wanted a refresher, also I lost everything from the first time I did the course. I decided to try out the newer version of Unity so I acknowledge that could be an issue but my scripts were working just fine and I already had the Mover Script attached to my player but then all of the sudden I started getting errors and my scripts wont attach anymore.

This probably has something to do with the version, and yes, it might be an issue, if you are using version control try resetting it to the previous state, if not, follow this steps, this usually helps me when getting this kind of errors, but try it with just one script if see if this helps:

  • Move your script to another folder.
  • Change the name of the script in Unity (this won’t change the code).
  • Create a new script in the original folder with the original name.
  • Copy paste your code.

Another way to do it is by copy-pasting the GitHub code, so you can simply delete it without getting nasty errors.

I did do what you suggested with moving the code around and trying to copy and paste it and I wasn’t having any luck. I recreated everything in a different version and its working fine so it must just be the version. Thank you for the help.

This sometimes happens if Unity fails to update it’s compiliation after a save. Another trick that sometimes helps in these rare instances is to delete the Library folder in your project. this forces a complete recompile of your project.