Search
 
SCRIPT & CODE EXAMPLE
 

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");
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# list to string join 
Csharp :: C# array index tostring 
Csharp :: asking for user input integer c# 
Csharp :: c# list grouping 
Csharp :: make folder with c# 
Csharp :: unity keycode for f 
Csharp :: void ontriggerenter not working 
Csharp :: untiy instanciate prefab 
Csharp :: how to create a file through c# script 
Csharp :: c# add picturebox to form 
Csharp :: keybyvalue c# 
Csharp :: c# array 
Csharp :: how to print using C# 
Csharp :: visual studio c# color dialog 
Csharp :: how to add a variable in unity c# 
Csharp :: c# loop string array 
Csharp :: c# list string return concatenate 
Csharp :: unity key up 
Csharp :: C# type cast float to string 
Csharp :: OnMousedown unity ui 
Csharp :: get device connected to player input unity 
Csharp :: ienumerable count 
Csharp :: Local to global position unity 
Csharp :: flip sprite in unity 
Csharp :: badlion 
Csharp :: lock pc using c# 
Csharp :: html.beginform 
Csharp :: unity audio 
Csharp :: c# parse string to xml 
Csharp :: c# clear all textboxes 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =