- Home /
Unity iPhone is crashing whilst running my game - how to debug?
I've just written some code and trying to test it using Unity Remote my new code is being triggered by a touch and then the entire Unity iPhone is stopping responding.
I have to force quit and restart it, thankfully the first time this happened most things were already saved.
I've started trying to add debug logs to see how far it gets before it crashes, though this is a little tedious as i can only see the last line output. Would prefer it if i could look at a text file of the log output. It's added to the console logs actually isn't it?
Anyways just wondered if anyone has seen this happen, any tips for things likely to crash it?
I do think it'd be nice if the play session could crash without taking down the entire editor but still i can appreciate how things could be getting a bit messy.
Thanks
What do you mean only one line? You mean the output that appears at the bottom left of the Unity window? Why don't you just hit shift+cmd+C to bring up the console window? That shows all your output using print or Debug.Log.
Answer by jimbobuk · Dec 07, 2009 at 08:34 PM
I managed to figure out where the crash was. An infinite loop caused by self recursion.
I'd still like to hear more expert advice on this but for anyone else, if you experience the entire program hanging then an infinite loop may be causing this. Something like this will cause it
void TestFunc()
{
...
TestFunc();
}
Answer by Jaap Kreijkamp · Dec 09, 2009 at 03:10 AM
Yes, unity hangs if you create function that doesn't return. The same holds (and is trickier to find) for Coroutines, if a coroutine loops and never yield you're in big trouble as well.
Your answer
Follow this Question
Related Questions
Using git on scripts - Why do i have to keep setting project permissions on launching unity? 1 Answer
How to get rid of the crash error in MonoDevelop 2 Answers
Debug.Log doesn't get called when Unity freezes? 2 Answers
How to stop editor from running a dead loop. 5 Answers
Debug.Log doesn't work properly in a ContextMenu function 3 Answers