- Home /
Recieve an event when Dropdown is closed?
Hi there,
We are having a very particular issue that we are quite sure it will have a very easy solution, but can't find the proper way to handle this. Here's our case scenario:
When we navigate our menus using keyboard (or a controller), when the user interacts with a dropdown option, our menu navigation is disabled so Up/Down only works as a selector inside the dropdown list options. Everything good so far, then when an option from the dropdown is selected, the onValueChanged event is thrown and the dropdown list is closed, so we use that event to give back the control to the UI. The problem comes when the user selects the same option that was already selected in the dropdown, since the onValueChanged event is never called and then the user is stuck because the dropdown list closed but the controls were not given back to our UI system due to the lack of event.
To solve that, we just need either to know when the dropdown list closes so we can use it instead of the onValueChanged event, or some sort of event/flag/whatever that is always called when an option of the dropdown is selected, no matter if it's the same or not.
Is there any simple way we can achieve this? We are using Unity v2017.4.11f1 from the LTS support builds, by the way.
Thank you very much in advance.
Answer by MechaWolf99 · Sep 26, 2018 at 08:36 PM
It's not 100% clear to be what you are doing. But it sounds like you could just use a EventTrigger component. And use on mouse up/ selected event in it. And just have it run the same method that the OnValueChange runs.
If not, then let me know.
That was actually the solution! Here is a screenshot of the setup that worked, in case anyone needs it in the future
Your answer
Follow this Question
Related Questions
Remove specific screen resolutions 0 Answers
GraphicRaycaster not hitting TextMeshPro Dropdown popup 2 Answers
Text Mesh Pro : Unable to use pull down menu inspite of Distance field 16 0 Answers
How to make dynamic dropdown to choose items in an Array? 2 Answers
How to get a dropdown menu to change the colour of a reticule on another scene 0 Answers