- Home /
Unity Crashing and Odd Script Behavior Permanently Afterwards
Hello,
I am very new to unity and I have run into an odd problem.
I was running the preview in unity and I had a script do something bad that froze it. So I used task manager to kill it.
Next time I started unity and ran my script (after I fixed the problem), the behavior was different than it should have been.
I had a Perlin noise generator class that basically stopped working. This class was in its own game object. It was however being called by reference through another game object (I had drug it onto the inspector to "link" it).
The only way to get my class to start working again was to delete the game object containing that class and recreate and link it to the referencing script.
This seems like it could be a very big problem in the future as my project grows. If I happen to get a crash and all of the sudden my classes stop working (but no errors in Unity), then I am going to have a heck of time trying to hook up all my references again to fix the problem.
Thoughts? Ideas? Comments?
Thanks!
Answer by Doireth · Jan 26, 2013 at 10:09 PM
Perhaps your project simply wasn't saved when you made the changes and the crash resulted in a forced close of Unity which meant all your changes were lost. I've had several crashes and only ever lost what I hadn't explicitly saved myself.
Answer by Mathias_Bras · Jan 27, 2013 at 03:09 PM
Hmm, I typed up a reply but it doesn't seem to have made it though...
Anyway, I am positive it was saved. When the the project loaded back up everything was where it should be and the code was correct. It just didn't work.
I spent some time debugging trying to figure out where the breakdown was. I never did find the particular line before I decided to delete the object and just recreate it. I didn't actually think it would fix the problem, but I figured it couldn't hurt.
After that it just worked. No code change or anything.