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

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();
}

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.