Question by
restdevelop · Nov 06, 2018 at 09:32 AM ·
dropdownprint
Dropdown options to text
Hi, I have a dropdown and there are some options in it,like ; America Africa Asia...
I want to print all options in only one text. Is it possible ? Thank you..
Comment
Best Answer
Answer by Hellium · Nov 06, 2018 at 09:44 AM
public UnityEngine.UI.Dropdown dropdown ; // Drag & drop the dropdown in the inspector
public void PrintOptions()
{
System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
Dropdown.OptionData[] options = dropdown.options.ToArray();
for ( int i = 0 ; i < options.Length ; ++i )
stringBuilder.Append( options[i].text );
Debug.Log( stringBuilder.ToString() );
}
Succesfully worked for me.. Thanks for speedy reply :)
Your answer
Follow this Question
Related Questions
UI Dropdown Add Different Sprites 0 Answers
Dropdown error 1 Answer
How to add color to dropdown item in runtime? 1 Answer
Get SpriteRenderer from Sprite? 0 Answers
Graphics quality dropdown saves playerpref but displays default? 2 Answers