Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity set dropdown value

IndexOf:

// returns a list of the text properties of the options
var listAvailableStrings = dropdown.options.Select(option => option.text).ToList();

// returns the index of the given string
dropdown.value = listAvailableStrings.IndexOf("an Option");

FindIndex

dropdown.value = dropdown.options.FindIndex(option => option.text == "an Option");
 
PREVIOUS NEXT
Tagged: #unity #set #dropdown
ADD COMMENT
Topic
Name
1+9 =