Skip to content

Commit 505b011

Browse files
committed
fix: Make first time user experience clearer.
1 parent b5b3b89 commit 505b011

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

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

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,13 @@ private static void RenderSetOfNamed<T>(
753753
ReorderableList.ElementHeightCallbackDelegate elementHeightCallback = null)
754754
where T : IEquatable<T>, new()
755755
{
756+
// If there are no items in the set of named, then add one so that
757+
// the user interface displays properly
758+
if (value.Count == 0)
759+
{
760+
value.Add();
761+
}
762+
756763
List<Named<T>> items = value.ToList();
757764

758765
// If there is only one item, then only render one set of inputs
@@ -822,28 +829,6 @@ private static void RenderSetOfNamed<T>(
822829

823830
list.DoLayoutList();
824831
}
825-
else
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();
846-
}
847832
}
848833

849834
private static void RenderDeploymentInputs(ref ProductionEnvironments value)

0 commit comments

Comments
 (0)