diff --git a/src/Assets/ugui-mvvm/Editor/DropDownMenu.cs b/src/Assets/ugui-mvvm/Editor/DropDownMenu.cs index 0ec2877..6ed33ca 100644 --- a/src/Assets/ugui-mvvm/Editor/DropDownMenu.cs +++ b/src/Assets/ugui-mvvm/Editor/DropDownMenu.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using UnityEditor; using UnityEngine; @@ -34,6 +35,8 @@ public class DropDownMenu private readonly List _dropDownItems = new List(); private int _selectedItem = -1; + public List Items => _dropDownItems.ToList(); + /// /// The number of items in the list. /// diff --git a/src/Assets/ugui-mvvm/Editor/PropertyBindingEditor.cs b/src/Assets/ugui-mvvm/Editor/PropertyBindingEditor.cs index 0a3ce2b..6606cce 100644 --- a/src/Assets/ugui-mvvm/Editor/PropertyBindingEditor.cs +++ b/src/Assets/ugui-mvvm/Editor/PropertyBindingEditor.cs @@ -393,8 +393,12 @@ private static int DrawBindingComponent(SerializedProperty componentPathProperty EditorGUILayout.HelpBox($"Select an event that indicates the property has changed, or update the binding mode.", MessageType.Warning); } } + else if (dropDownMenu.ItemCount == 1) + { + dropDownMenu.Items[0].Command(); + } - updateTriggerCount = dropDownMenu.ItemCount; + updateTriggerCount = dropDownMenu.ItemCount; } return updateTriggerCount;