Answers for "unity set dropdown value"

1

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");
Posted by: Guest on June-28-2021

Code answers related to "unity set dropdown value"

Browse Popular Code Answers by Language