Last active
November 20, 2015 21:18
-
-
Save kalineh/74e20298f2627cadbbec to your computer and use it in GitHub Desktop.
Unity - Utility function that pauses unity editor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class DebugPauseEditor | |
: MonoBehaviour | |
{ | |
public static void Pause() | |
{ | |
var target = "UnityEditor.EditorApplication"; | |
var assemblies = System.AppDomain.CurrentDomain.GetAssemblies(); | |
foreach (var assembly in assemblies) | |
{ | |
try | |
{ | |
var type = assembly.GetType(target); | |
var property = type.GetProperty("isPaused"); | |
property.SetValue(null, true, null); | |
} | |
catch | |
{ | |
// ignore | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment