private static void OnDebuggerAttached(bool debuggerAttached)
{
if (debuggerAttached)
{
if (CodeOptimization.Release == CompilationPipeline.codeOptimization)
{
if (EditorUtility.scriptCompilationFailed)
{
EditorUtility.DisplayDialog(
"C# Debugger Attached",
"All compiler errors must be fixed before switching to debug mode.",
"Ok");
ManagedDebugger.Disconnect();
}
else
{
if (EditorUtility.DisplayDialog(
"C# Debugger Attached",
"Do you want to switch to debug mode to enable C# debugging?\nDebug mode reduces C# performance.\nSwitching to debug mode will recompile and reload all scripts.",
"Switch to debug mode",
"Cancel"))
{
ToggleDebugState(CompilationPipeline.codeOptimization);
}
else
{
ManagedDebugger.Disconnect();
}
}
}
}
AppStatusBar.StatusChanged();
}