Dropdown.ClearOptions does not work
I am trying to save a new string to my medicin list, and save it with playerPrefs. I then want to clear out my dropdown menu options, and then add the medicin list.
m The problem is, i can't get my dropdown menu to clear. i am using dropdown.ClearOptions: https://docs.unity3d.com/560/Documentation/ScriptReference/UI.Dropdown.ClearOptions.html
I am getting the error: Assets\dropdownList.cs(65,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement.
I really have no idea why i can't simply clear the dropdown list.
public InputField addItem; public Dropdown menu; public List medicin = new List() { "", "Primcillin 800 MG 1x3 i 10 dage" };
public void AddToList () {
medicin.Add(addItem.text);
for (int i = 0; i < medicin.Count; i++)
{
PlayerPrefs.SetString("med" + i, medicin[i]);
}
**menu.ClearOptions;**
menu.AddOptions(medicin);
}
Answer by RobeKey · Apr 12, 2020 at 02:51 PM
Try
menu.ClearOptions();
:)
Thank you! I feel both very happy and very stupid.
Your answer
Follow this Question
Related Questions
Showing what a user has chosen from a dropdown menu 1 Answer
Writing dropdown selections to file 1 Answer
Scrolling of drop down menu 1 Answer
UI - Scroll through a list of items 0 Answers
How do you do a dropdown menu that changes resolution? 0 Answers