Skip to content

Commit 40631a2

Browse files
TsFreddievanifatovvlad
authored andcommitted
Support Foldout SerializedProperty
1 parent bad2a19 commit 40631a2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Editor/Utilities/TriEditorGUI.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@ public static class TriEditorGUI
88
public static void Foldout(Rect rect, TriProperty property)
99
{
1010
var content = property.DisplayNameContent;
11-
property.IsExpanded = EditorGUI.Foldout(rect, property.IsExpanded, content, true);
11+
if (property.TryGetSerializedProperty(out var serializedProperty))
12+
{
13+
EditorGUI.BeginProperty(rect, content, serializedProperty);
14+
property.IsExpanded = EditorGUI.Foldout(rect, property.IsExpanded, content, true);
15+
EditorGUI.EndProperty();
16+
}
17+
else
18+
{
19+
property.IsExpanded = EditorGUI.Foldout(rect, property.IsExpanded, content, true);
20+
}
1221
}
1322

1423
public static void DrawBox(Rect position, GUIStyle style,

0 commit comments

Comments
 (0)