Skip to content

Commit

Permalink
fix Main() toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonMa0012 committed Sep 26, 2022
1 parent 52c10c5 commit a73b7de
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions Editor/DrawerUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion Editor/ShaderDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down

0 comments on commit a73b7de

Please sign in to comment.