How do I refer to value retrieved from a dropdown menu?

Thanks in advance, mates.
I know I can use GameObject.Find()getcomponent<>(). = refer to a value in a gameobject…
But it seems that didn’t work with dropdown??

I can see value changed from 0 to 1 to 2 when option1,2,3 is selected respectively, but I don’t know how to refer to this value…

Can anyone please help? I am using C#.

http://docs.unity3d.com/ScriptReference/UI.Dropdown-value.html
that will give you the current selected value

if you need to know what the option is you can use the index value from the above to pull out the appropriate value from the list returned by
http://docs.unity3d.com/ScriptReference/UI.Dropdown-options.html

Yes…I have read these from script doc …But I still don’t know how can I retrieve that option value (an integer) , and refer to it in other script as an event trigger to trigger some function.

I have browse through the web, and I am testing with addlistener/ sendmessage/ delegate

But If someone can give be some direction will offer me so much help…

using UnityEngine.UI;

public Dropdown dd;

void Update()
{
    if(dd.value == someValue)
    {
        //Do something here!
    }
}
1 Like

I am trying to kick my own dump a** …
how come I try so long and don’t figure out this…

thx mate,
SO I will just have to find a way to use this int to call some function then…THX!!

1 Like

Here is the tutorial that will show you how to use Unity UI dropdown and Get its value

Here you add this to your code

public TMP_Dropdown GameType_DropDown;
public string GameType_DropDown_Txt;
public int GameType_DropDown_Int;

string[ ] genres = {“RPG”, “Adventure”, “Simulation”, “Puzzel”, “Quest”, “FPS Shooter”, “3rd Person Shooter”, “Other”, “Turn Based Combat”, “Melee Combat”, “Fantasy”};

GameType_DropDown_Int = GameType_DropDown.value;
for (int i = 0; GameType_DropDown_Int >= i; i++)
{
GameType_DropDown_Txt = genres*;*