Beispiel #1
0
        public static IDisposable LabelWidth(float width)
        {
            var prevWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = width;
            return(DisposableAction.Create(() => EditorGUIUtility.labelWidth = prevWidth));
        }
Beispiel #2
0
        public static IDisposable Color(Color color)
        {
            var oldColor = GUI.color;

            GUI.color = color;
            return(DisposableAction.Create(() => GUI.color = oldColor));
        }
Beispiel #3
0
        public static IDisposable Enabled(bool enabled)
        {
            bool wasEnabled = GUI.enabled;

            GUI.enabled = wasEnabled && enabled;
            return(DisposableAction.Create(() => GUI.enabled = wasEnabled));
        }
Beispiel #4
0
 public static IDisposable Area(Rect rect)
 {
     GUILayout.BeginArea(rect);
     return(DisposableAction.Create(() => GUILayout.EndArea()));
 }
Beispiel #5
0
 internal static IDisposable Horizontal(params GUILayoutOption[] options)
 {
     EditorGUILayout.BeginHorizontal(options);
     return(DisposableAction.Create(EditorGUILayout.EndHorizontal));
 }
Beispiel #6
0
 internal static IDisposable Vertical(GUIStyle style, params GUILayoutOption[] options)
 {
     EditorGUILayout.BeginVertical(style, options);
     return(DisposableAction.Create(EditorGUILayout.EndVertical));
 }
Beispiel #7
0
 public static IDisposable ScrollViewWindow(Vector2 scroll)
 {
     EditorGUILayout.BeginScrollView(scroll, false, false, GUIStyle.none, GUIStyle.none, GUIStyle.none);
     return(DisposableAction.Create(EditorGUILayout.EndScrollView));
 }
Beispiel #8
0
 public static IDisposable ScrollView(ref Vector2 scroll, GUIStyle style, params GUILayoutOption[] options)
 {
     scroll = EditorGUILayout.BeginScrollView(scroll, style, options);
     return(DisposableAction.Create(EditorGUILayout.EndScrollView));
 }
Beispiel #9
0
 public static IDisposable ScrollView(ref Vector2 scroll)
 {
     scroll = EditorGUILayout.BeginScrollView(scroll);
     return(DisposableAction.Create(EditorGUILayout.EndScrollView));
 }