- Home /
Script says compiler errors, but none is shown.
I have a very weird problem. I have two scripts in the scene that give an error "The associated script can not be loaded. Please fix any compiler errors and assign a valid script." All other scripts work.
Here's the catch though. Those script have no errors. In fact they are empty except for class declaration. Unity console shows no errors and I can run the scene with only error shown is "The referenced script on this Behaviour is missing!".
What I have tried to solve the problem so far:
Reboot Unity.
Delete Library folder.
Tried an older version of Unity.
Reboot Computer.
Reimport all.
Unity console does have errors as visible (Working script do give proper output on Debug.LogError()
Most combination of these
Deleting the .meta files will not remove the error, but will mark the scripts as missing. After they are set again the same error persists.
Changing these scripts to another script and back again removes the error until I run the scene and then the error reappears again.
Any ideas on how to solve this would be great.
This is a great troubleshooting list. Reimport All seems to have fixed my error. +1
Answer by revolute · Aug 22, 2014 at 09:28 AM
Check their names. Script name and script class name should be identical.
Thank you. This did indeed solve the problem. There was a case issue on the files. For future reference. Unity does not give error if you change scripts with the circle button, but does give the error if you try to drag and drop the script.
Answer by MADiFold · Nov 14, 2021 at 01:15 PM
You also get this issue when opening a project from a shared drive.
Your answer
