diff --git a/Scripts/Controls/ComboBox/AutoCompleteComboBox.cs b/Scripts/Controls/ComboBox/AutoCompleteComboBox.cs index f637406..d7fba23 100644 --- a/Scripts/Controls/ComboBox/AutoCompleteComboBox.cs +++ b/Scripts/Controls/ComboBox/AutoCompleteComboBox.cs @@ -112,11 +112,19 @@ namespace UnityEngine.UI.Extensions } } + public bool SelectFirstItemOnStart = false; public void Awake() { Initialize(); } + public void Start() + { + if (SelectFirstItemOnStart && AvailableOptions.Count > 0) { + ToggleDropdownPanel (false); + OnItemClicked (AvailableOptions [0]); + } + } private bool Initialize() { diff --git a/Scripts/Controls/ComboBox/DropDownList.cs b/Scripts/Controls/ComboBox/DropDownList.cs index b4bfd33..7c5a0f7 100644 --- a/Scripts/Controls/ComboBox/DropDownList.cs +++ b/Scripts/Controls/ComboBox/DropDownList.cs @@ -107,10 +107,15 @@ namespace UnityEngine.UI.Extensions } } + public bool SelectFirstItemOnStart = false; public void Start() { Initialize(); + if (SelectFirstItemOnStart && Items.Count > 0) { + ToggleDropdownPanel (false); + OnItemClicked (0); + } } private bool Initialize()