/// <summary>
 /// Exits the editor with the specified exit code.
 ///
 /// If the editor is running in batch mode, the Unity process will
 /// exit with:
 ///     exitCode == 0 -> success
 ///     exitCode != 0 -> error condition with given code
 ///
 /// If the editor is running in graphical mode, script execution
 /// will be halted instead.
 /// </summary>
 /// <param name="exitCode">Exit code.</param>
 public static void ExitEditor(int exitCode = 0)
 {
     #if UNITY_EDITOR
     // If we are running in batch mode, fully exit Unity with exitCode.
     if (IsBatchMode())
     {
         _instance.Log("ExitEditor( " + exitCode + " )");
         EditorApplication.Exit(exitCode);
     }
     else         // We are in the graphical editor, stop script execution. exitCode is ignored.
     {
         _instance.Log("ExitEditor( " + exitCode + " ) isPlaying = false");
         UnityEditor.EditorApplication.isPlaying = false;
     }
     #else
     _instance.LogWarning("ExitEditor(): no-op, called in non-editor environment.");
     #endif
 }