The referenced script on this Behaviour is missing! (Filename: C:/buildslave/unity/build/Runtime/Mono/MonoBehaviour.cpp Line: 1560)

My Unity project appears to have become corrupt. Running it results in many console errors such as this:

The referenced script on this Behaviour is missing!

(Filename: C:/buildslave/unity/build/Runtime/Mono/MonoBehaviour.cpp Line: 1560)

I also see many errors like these:

GameObject (named ‘Text’) references runtime script in scene file. Fixing!

(Filename: C:/buildslave/unity/build/Runtime/Mono/MonoBehaviour.cpp Line: 1083)

GameObject (named ‘Button’) references runtime script in scene file. Fixing!

(Filename: C:/buildslave/unity/build/Runtime/Mono/MonoBehaviour.cpp Line: 1083)

As per a few other issues that I googled, I deleted all objects that appeared to be referencing scripts and recreated them. The error persisted.

I then deleted all objects and readded them. No luck.

I switched scenes and the error persisted.

I created an empty scene and added a few UI objects and the errors were back.

What do I do?! I haven’t yet backed up my project today :frowning:

Thanks.

P.S. New projects work fine.

I had this issue and drove me nuts. I believe it occurred after moving some scrips and files(I was trying to be organized). Every time, I would create a button in UI canvas, it would give me the error, and state it was fixing. I clicked on “Assets” - > “Reimport All” → will close down and restart Unity3d. Also make sure you save any work. once you restart, go back to the scene with errors and the error will appear again. click Play button, to run the scene and Unity will fix accordingly. After play the scene again, and the error should be gone.

I could not rescue this and had to manually recreate recent changes in the Editor UI in a fresh project. But I believe that this issue very likely arose due to the renaming of scenes and folders. Just an FYI for others who are stuck.

Thanks.