- Home /
"The associated script cannot be loaded" on every Script in every GameObject in the project. Corrupted Project.
This is not really a question, this is an answer for everyone that may have this problem. (I solved this a minute ago)
It all happened when I was synchronizing my project on a remote server, and opened at the same time the same project in Unity. When I looked at the scene objects, every script on every GameObject was saying "The associated script cannot be loaded, please fix errors, etc.".
The project seemed corrupted and I thought I had lost a lot of work.
And, I had no errors, the bar at the bottom said nothing even when I tried to change a script.
Everything was fine before.
The first time I opened a script, I got some weird error about the solution being wrong.
Each time I opened the project, I get a "compiling script" progress bar, that stops in the middle, then opens the project.
If I pressed Play, it said I had to fix the errors.
Answer by Penj · Apr 20, 2017 at 05:36 PM
This just happened to me! Crazy scare! Wow!
Here's all it is... (As what my understanding is/how I resolved my problem)
For some reason, if you have "compiler errors", the inspector will NOT load the scripts. (even though we both know they are there, and there are NO problems with them)
But... In MonoDevelop, hit "F8", and you should see some compiler errors. Fix those, then go back to the inspector, and your problem should be fixed.
At least that's what I did, and it worked fine.
This!!! Third time it happened to me this year and the other 2 times I wasted hours putting everything back together. This time I cleared all compile errors and all references were back to normal.
Answer by NeatWolf · Mar 20, 2014 at 05:39 PM
My solution:
Don't touch anything in the project.
In the file manager take the last 1-2 scripts you were working on, and move them out of the project folder.
Reopen the project.
The project should be working fine now.
If you drag again the files on the project (mine was a c# script), it WON'T compile again. Should be something in that script that the compiler doesn't like.
Recreate the new scripts from scratch, and add small portions of code copied from the copy you moved away, and try to isolate the lines of the code that seems to cause the issue.
Save the file each time. If you don't get any errors, may also mean the compiler has crashed. To be sure everything's working, run the project.
EDIT: for some reasons, after the crash the console disappeared - that could be the cause of the silent compilation fails.
Make sure to re-enable it from the Window menu.
Answer by SaifHakeam97 · Aug 28, 2018 at 02:39 PM
the same issue just happened to me. The reason was bcz I've renamed one of the scripts(inside Unity) which were referenced in another script.Visual Studio couldn't detect the issue so just make sure that the files in Unity has the same class name in the Visual Studio.
I had ran into the same problem. So, we should always be careful while rena$$anonymous$$g scripts
Answer by yogurt1989 · Aug 09, 2017 at 09:05 PM
Try right click on the folder where you keep your scripts or in each individual file and click on "Reimport", as an alternative click on "Reimport All" on your assets folder but the later can take a few hours in a big project.
I need to reimported all scripts and afterwards removed the last script i used in my project, then i dragged the script into my unity project again and all was working fine
Answer by klimentievyr · May 28, 2018 at 10:53 AM
привет, столкнулся с такой же проблемой. Ошибка была в том, что файл скрипта должен соответствовать названию класса,привет, тоже столкнулся с такой проблемой. Проблема была в том, что имя скрипта в Visual Studio и в Unity отличались. пример RepairInventoryItems и RepairInventoryIteMs