Prevent crashes on exceptions when debugging?

The whole UE4 editor stops when it encounters an exception. Is there a way to prevent this, just stop the game and return to the editor?

I had this problem both on mac OS X and windows.

The only way to debug (being able to set breakpoints) my app on OS X in Xcode is to select the active scheme “ProjectNameEditor - Mac > My Mac”. But it takes a while to launch and stops as soon as there is an exception. Is there a better way?

Not really. UE4 doesn’t actually throw exceptions in the sense of C++ exceptions – it just fails assertions and terminates. (“Real” C++ exceptions are actually disabled in UE4). The check() macro is often used to guard against running things that could cause serious harm if executed – buffer overflows allowing security exploits, dangerous filesystem I/O operations, etc. ‘Continuing’ in this case could be really dangerous. If you hit your own breakpoint in Visual Studio, you can hit continue, but continuing after a failed assertion/check will probably just result in the program terminating (I don’t know about XCode specifically).

That being said, if you have a taste for danger, you could build UE4 from source and redefine check() to do something other than terminate in case the condition isn’t true.

It would be better to just stop the game when it fails assertions. Is that possible? Or there is no easy way to just keep the editor running and only debug the game?

Sadly, not that easily. Play-in-editor (without the ‘standalone’ launch mode) runs the game code in the same OS process as the editor. So if any one part of it goes down, the whole thing goes down. One way you can mitigate this is to launch your play session as ‘Standalone’ instead of in the game viewport (though obviously this increases the launch time).

(Also, the UE4 AnswerHub unmarks a response as ‘answered’ if anyone comments on it, so you have to mark it ‘accepeted’ again afterwards :frowning: )

Ok thank you, I’ll re-accept the answer (weird). So every C++ developers relaunch the whole editor on each assertion fail? Ouch!!!

Yep: Sounds like it. Unreal is hell for c++ programmers.