Is this one of those things that aren’t supposed to work in Unity?
[InitializeOnLoad]
public class EditorOnLoad {
static EditorOnLoad()
{
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += currentDomain_UnhandledException;
}
static void currentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
GlobalManager.KillPeer();
}
}