"The associated script can not be loaded" - after git pull

My project works fine locally, but after I uploaded it to a git repository and pulled down a separate copy of the code, but when I pull open my project, all of my scripts appear to be missing, saying “The associated script can not be loaded. Please fix any compiler errors and assign a valid script.” There are no compiler errors, and the project runs, but nothing does anything, because all of my scripts are broken.

So clearly something is being modified or left out of my git repository, because my original local copy works just fine. It’s only this second copy that I pulled down that is broken. The scripts are all there, and if I remove the broken script and re-add it, it works just fine.

How can I determine what is missing from the downloaded copy of my code that has broken all of my scripts?

There are certain things you need to do and avoid when using source control with Unity.

  1. Have you enabled meta tags in your project?
  2. Have you .gitignored the Library folder?

If you have followed the guidelines for source control in Unity, then the problem is most likely with your repo. Try committing to a new fresh one following the guideslines, and see if that works.

See Also:

  1. Using External Version Control Systems with Unity
  2. Another Unity Answers post