#if UNITY_EDITOR using UnityEngine; using System.Collections.Generic; namespace GSpawn { public static class GUIEx { static Stack _colorStack = new Stack(); static Stack _contentColorStack = new Stack(); static Stack _matrixStack = new Stack(); public static void saveColor() { _colorStack.Push(GUI.color); } public static void restoreColor() { if (_colorStack.Count != 0) GUI.color = _colorStack.Pop(); } public static void saveContentColor() { _contentColorStack.Push(GUI.contentColor); } public static void restoreContentColor() { if (_contentColorStack.Count != 0) GUI.contentColor = _contentColorStack.Pop(); } public static void saveMatrix() { _matrixStack.Push(Gizmos.matrix); } public static void restoreMatrix() { if (_matrixStack.Count != 0) GUI.matrix = _matrixStack.Pop(); } } } #endif