Creating a dynamic Dropdown list without losing focus of InputField?

I’m creating a dropdown with a searchbar on top. Basically, I put an inputfield on top of the dropdown.

When you click the input field, the dropdown opens and when you type something into it, the dropdown should update its list Dynamically.

Here’s the problem I’m having, the dropdown option changes in the inspector. However, the dropdown in the scene doesn’t show its updated options.

When I do Dropdown.Hide() and then Dropdown.Show(), it updates but then I lose focus on the inputfield.

I can always just do Inputfield.Select() but then the whole inputfield gets highlighted and you have to click the position you were at to be able to edit from where you were.

Any suggestions?

1 Like

Assuming there’s no other way to rig up the Dropdown list to behave properly (I have no experience with it so I couldn’t tell you), you can always store the InputField.caratPosition before you hide/show the dropdown and then set the caratPosition back again after your InputField.Select() call. That should put your cursor right where you left off.

2 Likes