Skip to content

Commit

Permalink
[Foldout] is now supported by Unity version below 2019.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrizov committed Oct 10, 2020
1 parent b04bbd2 commit 777dd31
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
4 changes: 1 addition & 3 deletions Assets/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,14 @@ protected void DrawSerializedProperties()
_foldouts[group.Key] = new SavedBool($"{target.GetInstanceID()}.{group.Key}", false);
}

_foldouts[group.Key].Value = NaughtyEditorGUI.BeginFoldout_Layout(_foldouts[group.Key].Value, group.Key);
_foldouts[group.Key].Value = EditorGUILayout.Foldout(_foldouts[group.Key].Value, group.Key);
if (_foldouts[group.Key].Value)
{
foreach (var property in visibleProperties)
{
NaughtyEditorGUI.PropertyField_Layout(property, true);
}
}

NaughtyEditorGUI.EndFoldout_Layout();
}

serializedObject.ApplyModifiedProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,6 @@ public static void EndBoxGroup_Layout()
EditorGUILayout.EndVertical();
}

public static bool BeginFoldout_Layout(bool unfolded, string label = "")
{
return EditorGUILayout.BeginFoldoutHeaderGroup(unfolded, label);
}

public static void EndFoldout_Layout()
{
EditorGUILayout.EndFoldoutHeaderGroup();
}

/// <summary>
/// Creates a dropdown
/// </summary>
Expand Down

0 comments on commit 777dd31

Please sign in to comment.