- Home /
The question is answered, right answer was accepted
Unity freezes up completely without explanation
I have been having this strange issue. I had a slightly similar issue that was addressed in another question, and everything worked well for a couple days, but now this issue does not seem to be code related. Whenever one trigger collider collides with another trigger collider, Unity freezes entirely. I have commented out all code that referenced these two objects that are colliding. However, Unity still crashes.
I have also tried
Reinstalling Unity 4.6.2
Cleaning and Building my projects in Monodevelop
Disabling all scripts on the objects and referencing the objects
Update
With the help of @meat5000, we have determined that this issue does not occur for everyone, therefore, it is most likely an issue with my Unity Client.
$$anonymous$$y previous question is located here: http://answers.unity3d.com/questions/892934/unity-crashes-when-ontriggerenter-occurs.html
However, I have commented out almost that entire script seen in the question but still freezing.
No while loops at all in any code relating to the objects in question
Nothing is shown in console at all before crash.
It doesn't matter if they relate to the object, they could still halt the main loop.
Everything else works fine; however, when my character walks into a certain trigger with no code (that isnt fully commented out) referencing it, Unity instantly freezes.
Answer by meat5000 · Feb 17, 2015 at 03:08 PM
You are getting MissingComponentException trying to access the non-existent renderer of the camera.
These errors and NullRefs have be known alone to make Unity grind to a halt.
In conjunction with OnTriggerStay, a function to be avoided, this could be the problem.
The script that you refer to has worked for me in the past. Why would the camera not have a renderer? Also the OnTriggerStay function is used in the Unity S$$anonymous$$lth project, which is what I redesigned for my AI system.
The player/enemy has a renderer, because you want to see it. Access that ins$$anonymous$$d.
The camera will have to contain a renderer if you want to see it. But I suspect you dont.
Stay is there to be used, but you've got to be careful with it.
Expensive operations should really be avoided within it.
Your tris and draw calls are pretty high indeed. I must admit, my PC eats it for breakfast.
What are your computer specs?
I have yet to optimize anything yet, I am also having an issue lightmapping which is one of main performance killers. I have a pretty high quality PC as well, 12 GB RA$$anonymous$$ and GeForce GTX 860$$anonymous$$, Intel i7 Processor.
It was the renderer part. I disabled that section of code, as I do not need to implement it yet anyways, and now it works. Thanks!