diff --git a/Editor/DrawerUtility.cs b/Editor/DrawerUtility.cs index 2cf4691..ad18f60 100644 --- a/Editor/DrawerUtility.cs +++ b/Editor/DrawerUtility.cs @@ -663,8 +663,13 @@ public static bool Foldout(Rect position, ref bool isFolding, bool toggleValue, var toggleRect = new Rect(rect.x + 8f, rect.y + 7f, 13f, 13f); - if (hasToggle) - toggleValue = GUI.Toggle(toggleRect, toggleValue, String.Empty, new GUIStyle(EditorGUI.showMixedValue ? "ToggleMixed" : "Toggle")); + if (hasToggle) + { + EditorGUI.BeginChangeCheck(); + GUI.Toggle(toggleRect, EditorGUI.showMixedValue ? false : toggleValue, String.Empty, new GUIStyle(EditorGUI.showMixedValue ? "ToggleMixed" : "Toggle")); + if (EditorGUI.EndChangeCheck()) + toggleValue = !toggleValue; + } var e = Event.current; if (e.type == UnityEngine.EventType.MouseDown && rect.Contains(e.mousePosition)) diff --git a/Editor/ShaderDrawer.cs b/Editor/ShaderDrawer.cs index 53abba0..54b043c 100644 --- a/Editor/ShaderDrawer.cs +++ b/Editor/ShaderDrawer.cs @@ -61,7 +61,7 @@ public override void OnGUI(Rect position, MaterialProperty prop, GUIContent labe EditorGUI.BeginChangeCheck(); bool toggleResult = Helper.Foldout(position, ref _isFolding, toggleValue, _defaultToggleDisplayed, label); - EditorGUI.showMixedValue = false; + // EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { diff --git a/package.json b/package.json index 41553c5..3565f0f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.jasonma.lwgui", - "version": "1.2.3", + "version": "1.2.4", "displayName": "LWGUI", "description": "A Lightweight, Flexible, Powerful Shader GUI System for Unity.", "keywords": [