This question was
closed Dec 27, 2016 at 05:52 PM by
hellojbb1234 for the following reason:
The question is answered, right answer was accepted
Question by
hellojbb1234 · Dec 26, 2016 at 10:12 PM ·
functiondropdown
How do you add options slowly to a dropdown menu?
how do you add options to the dropdown menu as the game progresses. like
if(this.gamObject.tag == "Fattyblob"){
Call Addtoindex();
}
void Addtoindex(){
add new object int option and sprite and text to dropdown menu
}
Comment
Answer by TBruce · Dec 26, 2016 at 10:13 PM
It can be done like so
public Dropdown dropDown;
if(this.gamObject.tag == "Fattyblob")
{
Addtoindex();
}
void Addtoindex()
{
if (dropDown != null)
{
dropDown.options.Add(new Dropdown.OptionData("New Option" + dropDown.options.Count));
}
}