r/UnityHelp • • Jan 06 '22

PROGRAMMING (UI) How to call some function when no option is choosen in dropdown?

As in title. I want to call some function when user clicks beyond of dropdown and it hides options.

3 Upvotes

3 comments sorted by

1

u/cone5000 Jan 06 '22

This is not nearly enough information. Please provide more info, including code, images, video, etc.

1

u/DaronFox Jan 07 '22

given:

there is a simple dropdown UI element

when:

user clicks on dropdown (it causes show dropdown options) and clicks beyond the dropdown (it causes hide options)

then:

function X is called

It's possible to call X function when value is changed https://docs.unity3d.com/2018.3/Documentation/ScriptReference/UI.Dropdown-onValueChanged.html
but i don't know how to call function when user just click beyond the dropdown and didn't select any option.

1

u/cone5000 Jan 07 '22

Could you just put a big collider behind the dropdown, that catches any touches that aren't on the dropdown itself?