AGAIN!!! So I just uploaded unity and 'ugh!' where have all my scripts gone!!??

This is an edit in case a search brings you here (if you are experiencing the same issue). Firstly, don’t panic, very often the case is that one of your scripts (or more) has an error. If you save unity and exit with a faulty script… The next loading will present you with all scripts having a missing link…

Correct the scripts in monoDevelp (or your editor of choice) and the problem will resolve. You don’t need to drag any scripts around, it will magically right itself…

If you are unsure what script is causing the trouble, look at the bottom of unity and you should see an error… This should lead you to the trouble causing script… To quickly check if this is the case, edit the relevant script and comment them whole thing out… Save it, go back to unity and see if the problem has been solved :wink:

This has worked for me… Start doing this to the last script you were working on, then the next etc…

Good luck! And this is probably not the ONLY reason for a fault like this, but for me, it has been twice, if not three times now.

Below is the Original post

//===========================================================

I have just fired up unity for this evenings session, only I have a strange problem. All of my scripts are expressing an error in the inspector, all of the object references have gone and a message reads as follows:

“The associated script can not be loaded. Please fix all compile errors and assign a valid script”

What has happened? The build was running fine last night and all of my scripts are still there, I can open and edit them as per normal in monoDevelop. I have tried exiting and reloading and the same instance occurred?

Mind boggled… :confused:

I have almost 100 scripts not working!? wow

Even the GUI buttons ‘+’ fields are affected

Even stranger… I have saved my project various times, so I have a reference to go ‘back in time’ so to speak… All of these other saves are suffering the same fate…

Anyone?

Thanks

After almost an hour frantically scouring the web… It seems I had deleted a gameobject that had a script on it without deleting the actual script from the project… Quite why this would effect every other script in the project is beyond me!?

Looks like I’m back up and running though

1 Like

It’s super odd that other saves were effected. I wonder if it wasn’t something messing with access to the compiled script DLL that was stopping them from loading. The fact that you eventually got them back says all the relevant data was still there.

Are you manually doing that or using a version control system like Git?

I am manually ‘saving as’…

I had created a gameobject… created a script upon it… then deleted the gameobject… Only the script was still in monodevelop… At least that’s what I understand the problem was… Phew as I deleted that script all was well… :smile:

No, that’s almost certainly not it. You can create and delete GameObjects and scripts independently from one another just fine. The only thing that should break is a GameObject’s reference to a script you delete, which makes sense since it’s not there anymore.

Whatever went wrong with your multiple projects simultaneously was not that.

I don’t know what you meant by “manually saving as”, but you can’t “save as” a project, only a scene. If you want to create a copy of a project, you need to manually duplicate the entire project folder.

2 Likes

I missed that. What you’re doing is not saving versions of the project, only the scene within the project. Scripts belong to the project, so that’s why they all got messed up when something went wrong.

If you want to save versions of a project (which you should) and you insist on doing it manually (which is better than nothing) you have to do what Devil_Inside says and copy the whole project’s folder.

1 Like

Ah I see, thanks for clearing that up, and also for the advice. Appreciated

2 Likes

I’ve had quite a few issues with the 4X series of Unity (5) hasn’t done it yet. But,
I’d save game 5 times, save project 5 times (just to make sure it went through) because 1 time wouldn’t work right,
I’d loose entire scenes, Scripts no longer existed, nothing whatsoever, well the only fix I found was to delete or rename the Library folder in your project folder then restart Unity and everything would be back to normal temporarily.

Next time you need to backup your project before updating Unity. Consider Version Control.

4 Likes

Errrrr… And again the ‘missing scripts boogie-man’ strikes :confused:

I finally made progress with a big script that I have been working on for the last week. Subsequently tidied up a bunch of game objects with their relevant scripts deleted etc (failed prototypes etc)… Also have done a full system scan on my machine.

Was working perfectly last night… What the hell is going on here!?

Suggestions most welcome please

Thanks, peace x

So, this time I had a simple compile error in one of my scripts… This alone stopped every other script loading in… Can someone explain why this happens please, I can’t grasp how one bad script can affect the ‘finding’ of every other ‘good’ script.

Thanks

Try turning off AutoRefresh, and then when you edit aq script refresh Unity manually with CTRL+R. Make absolutely sure that BEFORE you exit Unity, you have refreshed and taken care of any script errors. I’ve found that if I start Unity up and there are any errors in a script that I hadn’t corrected before exiting, it has a tendency to have these types of problems.

Also… Make sure that you have taken care of any script errors before you open up the Asset Store window. It has also been known to cause missing script problems if everything isn’t peachy keen before opening it up.

1 Like

Thanks for the extra info… But, haha, well, if I complete a day without making script errors it’s because I haven’t scripted!

And often I am falling asleep in the wee hours with unity window open… Sometimes it freezes, I think my CPU goes into ‘owner’ mode and feels tired :smile:

Well that could be a clue right there. If you have errors in your scripts and Unity closes or even freezes like you say, then that may be the cause of your problems. Also, if you’re working so late that you fall asleep at your computer regularly then you might want to give some thought to taking it a little more easy.