r/UnityHelp • • May 07 '21

Get dropdown.onvaluechanged to check for text ?

Can I get onvaluechanged to check for the text content of a dropdown option? Or is it limited to only being able to read the integer value of the dropdown option?

I would like to run an IF function based on the text of a dropdown option instead of using its integer value. So instead of if( value == 0)... it would be if(value == "option A")...

Appreciate any help 🙏

4 Upvotes

1 comment sorted by

1

u/globalmaster17 May 07 '21

Solved

GetComponent<TMP_Dropdown>().captionText.text == "Option A".