Unity crashed, then alll scripts can't be loaded

No idea why this happened.

Unity went to black screen, possibly something to do with video card driver problem, regardless, it stopped responding and I have to close it to restart it.

Upon restart, I notice all my sprite images are missing, only with box colliders, and I went to inspector. It says “the associated script cannot be loaded, please fix any compile errors and assign a valid script”. I then when to inspect the code but I have done nothing to change anything. So I simply rebuild them and then I got bunch of errors all related to the unity library itself, such as "the type or namespace 'unityengine' could not be found'. 'the type or namespace 'MonoBehaviour' could not be found, are you missing an using directive or assembly reference?'

I also found my 2D Toolkit plugin is missing, except one list on the menu bar with one option “Setup for javascript”, there used to be a lot more than this, re-importing doesn’t fix the problem.

What happened here? I think this might be a bug with Unity…

Steps you should take:

A) Reboot completely.

B) If that doesn’t work, try re-installing Unity and rebooting again.

C) If that doesn’t work, create a new project, add an object and attach one of the scripts from the other project.

C-1) If it works, tears might be involved because it’s likely something was corrupted on the other one. Work slowly through all associated objects and carefully make sure that the settings are correct.

C-2) If it doesn’t work, check that the script is valid. Use a default built-in one and see if it works. If it does but yours doesn’t, there’s a problem with your script

C-3) If a default built-in script won’t work, you probably have a very bad hardware-level problem. Try the project on another computer. If it works there, get your PC serviced.

D) If it still won’t work anywhere, including the built-in scripts, let us know because that would be something ridiculous.

I had this problem and fixed it by fixing the compile bugs. Specifically

error CS0070: The event tk2dUIItem.OnClickUIItem' can only appear on the left hand side of += or -= when used outside of the type tk2dUIItem’

which resulted from trying to call

item.OnClickUIItem() -= FunctionName;

rather then

item.OnClickUIItem -= FunctionName;

as referenced here from unikronsoftware. As they mention, its Unity choking on one of your script errors and causing everything to fail to compile in a bad way. Its worth a look anyways before doing a complete reinstall.

I’ve had this problem. for me, one of my scripts was blank, and that was causing trouble. It probably isn’t the issue, but take a look through your scripts to see if one might be blank.

To solve this error I veryfied the script folder location and change it to to the one where the script was originally.

What worked for me was going to my latest script. I accidentally wrote

“if(player.something({
something = true;
}”

Did you notice the error? Backwards ending parenthesis. I didn’t even notice. At that point I got the error similar to what was mentioned in this post. Just make sure there are no errors in your scripts, so that unity doesn’t have a reason to complain. Once fixing this very minor error, my unity was reloaded and all the scripts and variables were still in tact.

Check your old scripts before you do this (almost) insane delete and re-import suggestion.

The following worked for me:
The error occured after importing new assets. I reverted/reimported standard assets and everything worked again.

Try Export Package your problem project, Create new project and Import it.
It work!!!

If anyone is still looking at this, I had the same exact problem and it happened when I made a copy of a script to modify / send to someone and forgot to remove it from the Unity directory and BAM… blew everything up. Can’t have two scripts with the same class name or it ruins everything. Deleting the copy fixed it.