Skip to content

Commit 03993d8

Browse files
committed
Force properties to be folded if there are no children to draw
1 parent 4148d81 commit 03993d8

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Assets/Editor Toolbox/Editor/Drawers/Toolbox/PropertyList/ScrollableItemsAttributeDrawer.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ static ScrollableItemsAttributeDrawer()
1717

1818
private static readonly PropertyDataStorage<Vector2, ScrollableItemsAttribute> storage;
1919

20-
2120
private void DrawSettingsBody(SerializedProperty property, ScrollableItemsAttribute attribute, out int size, out Vector2 indexRange)
2221
{
2322
EditorGUILayout.PropertyField(property.GetSize());
@@ -53,7 +52,6 @@ private void DrawElementsBody(SerializedProperty property, ScrollableItemsAttrib
5352
}
5453
}
5554

56-
5755
protected override void OnGuiSafe(SerializedProperty property, GUIContent label, ScrollableItemsAttribute attribute)
5856
{
5957
using (var propertyScope = new PropertyScope(property, label))
@@ -70,7 +68,6 @@ protected override void OnGuiSafe(SerializedProperty property, GUIContent label,
7068
}
7169
}
7270

73-
7471
private static class Style
7572
{
7673
//TODO: apply custom styling for the drawer

Assets/Editor Toolbox/Editor/Internal/PropertyScope.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ public void Dispose()
7171
Close();
7272
}
7373

74-
public bool IsVisible => property.isExpanded;
74+
/// <summary>
75+
/// Indicates whether property is expanded and has any children to draw.
76+
/// </summary>
77+
public bool IsVisible => property.isExpanded && property.hasVisibleChildren;
7578
public Rect LabelRect { get; private set; }
7679
public Rect InputRect { get; private set; }
7780
}

Assets/Examples/Scripts/SampleBehaviour6.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public class ClassWithInterface4 : ClassWithInterface2
8888
public int var33;
8989
}
9090

91-
#endregion
91+
#endregion
9292

9393
#region Generic Types
9494

0 commit comments

Comments
 (0)