Why is Unity crashing when I press play in the editor?

c#, crash, unity-game-engine

Solution

First, look at the editor logs, quite possible that the reason of the crash will be there. If unsure, post them here (post on gist and link here).

Also, if you have unity pro (or a trial version of pro), try looking at the profiler's readings. On free you can also try looking at the Stats button from the Game window. Using too much memory (RAM or VRAM) can cause crashes.

Problem

My game is crashing whenever I switch scenes and then press play in the editor. I am using this code to switch scenes: ... I have tried disabling most of the scripts in my game to debug the problem but it freezes every time. I've also tried loading the levels without the co-routines but that doesn't help. I can continue playing the game as long as I don't use the editor controls, however things get pretty choppy and performance becomes terrible.

Original source