Skip to content

Instantly share code, notes, and snippets.

@kalineh
Last active November 20, 2015 21:18
Show Gist options
  • Save kalineh/74e20298f2627cadbbec to your computer and use it in GitHub Desktop.
Save kalineh/74e20298f2627cadbbec to your computer and use it in GitHub Desktop.
Unity - Utility function that pauses unity editor.
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