- Home /
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...
Answer by Dracorat · Apr 08, 2013 at 08:37 PM
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.
Damn, this problem just happened AGAIN, now I start to doubt if that's the problem with my 2D Toolkit plugin...reinstalling everytime is annoying...
I had to delete and reimport the character controllers to work again in a new project..
How my last project got messed up- I downloaded the hoverscript from https://www.youtube.com/watch?v=Z8YG$$anonymous$$QvEz1Y.. It worked until I went to modify the maximum x and y in the mouselook script. Changing those values didnt make any difference.. After restarting I saw all those scripts under the character controller showing it had compilation errors.. That behaviour didnt make any sense to me as I am sure I did not modify anything using the monodev. Then I thought maybe changing that maximum x and maximum y values caused the problem(had nothing else to believe in :D) so I looked up on google for this http://answers.unity3d.com/questions/29741/mouse-look-script.html replaced the whole with the built in one and $$anonymous$$rs were involved in the decision of switching to cryengine... Because every single scripts in my project somehow got infected with HIV and had compilation errors..
Answer by dylanfries · Jul 16, 2013 at 01:34 AM
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.
Answer by Cornotiberious · Jul 16, 2013 at 01:57 AM
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.
Answer by polmonroig · Apr 21, 2014 at 10:32 PM
To solve this error I veryfied the script folder location and change it to to the one where the script was originally.
Answer by Tekksin · May 12, 2014 at 02:19 PM
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.
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
How to use Editor script? 3 Answers
Unity Script Editor Not Working 1 Answer
Paint on object in editor and return as texture. 1 Answer
Scripting a "Unity Editor"-like object transformation control 1 Answer