Oh… I thought maybe there was some fancy way I needed to do it.
Hardly anything there right now, so here the whole thing is. Right now it crashes after pressing ‘x’.
A lot of crashes are caused by memory leaks, and a lot of memory leaks are from infinite loops, although of course not all. But it’s a good starting point, to go check all your loops.
In CameraFlip.cs, I see you have this on line 45 :
I am suspecting this, as the way you have it, I don’t think that transform.localEulerAngles.y can ever be 0. So I’m suspecting (although just a guess, that you’re going to run into scenarios where it drops into this branch of the if, and it can’t ever evaluate the while condition to false to exit that loop.
I would at this point like to note the difference between a “crash” and a “freeze”. A crash means Unity exits immediately, probably with an error message. A freeze means it’s just stuck, and you have to force quit it yourself.
If it was a freeze, then @cstooch is most definitely right, as that loop looks absolutely prime freeze-causing material.
That seems to have been it. Odd. I wonder then what the value was it ended up on…
Edit: some further testing reveals it was changing between 180 and 179. Indeed it never could reach 0.
I have done away with using Euler stuff now, as much as I can. Thanks for the advice and help on this, everyone.