- Home /
Unity freezes when I add a special script
I have a problem with Unity freezing at a special script. First I was writing the script and it worked with no problems. then I added another function an unity freezed when starting the scene. So I commented the function out and it worked again. then I tried to assign the script to another object - now its freezing also with the fuction commented out. Has anyone recogniced something similar? What might be the problem there?
fschaar : No, there is no infinite loop and as I said: I commented the function out. But I have some testing functions in that script that can accidently return wrong values. maybe that is the cause? But it worked before with this functions ...
$$anonymous$$e : What Julien said is correct, most commonly it is an infinite loop that causes unity to close. Please post your script, or even just the function that you had to comment out. We can only guess without seeing the problem (I see Julien also suggested you post the code) =]
Wait - you are right! There was no loop in the function itself, but in the function that called it.
Answer by Julien-Lynge · Jul 23, 2012 at 03:18 PM
Most likely the function you added is causing an infinite loop. That is by far the most common cause of freezes when you code in any language. Can you post the function?
Your answer
Follow this Question
Related Questions
my mouse freezes when I hold down any key. 0 Answers
An instance of type 'TurretControl' is required to access non static member 'Shoot'. 1 Answer
Script error: OnTriggerEnter 1 Answer
What's wrong with this (Java)Script? Some parts don't work 0 Answers
When I kill one enemy, the rest disapear, but still shoot 1 Answer