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.


more ▼

asked Dec 07, 2009 at 08:22 PM

avatar image

1.3k 95 81 90

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.

Dec 07, 2009 at 08:33 PM equalsequals
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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()
more ▼

answered Dec 07, 2009 at 08:34 PM

avatar image

1.3k 95 81 90

(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Dec 09, 2009 at 03:10 AM

avatar image

Jaap Kreijkamp
7.3k 46 71 114

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Dec 07, 2009 at 08:22 PM

Seen: 3703 times

Last Updated: Dec 07, 2009 at 08:22 PM