Skip to content

Commit 03b3c52

Browse files
authored
Merge pull request #1071 from PlayEveryWare/fix/rendersetofnamed_empty
Fix: `RenderSetOfNamed` can render empty set
2 parents f0e8b87 + 5217fbc commit 03b3c52

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Assets/Plugins/Source/Editor/Utility/GUIEditorUtility.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,8 +823,26 @@ private static void RenderSetOfNamed<T>(
823823
list.DoLayoutList();
824824
}
825825
else
826-
{
827-
// TODO here
826+
{
827+
// If there are no items in the list, then the user needs to add an entry
828+
// before they can start modifying.
829+
EditorGUILayout.BeginHorizontal();
830+
831+
Rect rect = EditorGUILayout.GetControlRect();
832+
rect.height = EditorGUIUtility.singleLineHeight;
833+
834+
// Render the "+" button to add a new item
835+
if (GUILayout.Button("+", GUILayout.Width(24)))
836+
{
837+
addNewItemFn();
838+
}
839+
840+
if (!string.IsNullOrEmpty(helpUrl))
841+
{
842+
RenderHelpIcon(helpUrl);
843+
}
844+
845+
EditorGUILayout.EndHorizontal();
828846
}
829847
}
830848

0 commit comments

Comments
 (0)