DropDownOption addOption(string name) { DropDownOption newOption = null; if (refresh) { if (refreshOptionIndex < options.Count) { newOption = options[refreshOptionIndex]; newOption.Option.onClick.RemoveAllListeners(); newOption.Delete.gameObject.SetActive(true); newOption.Delete.onClick.RemoveAllListeners(); } } refreshOptionIndex++; if (newOption == null) { newOption = Instantiate <DropDownOption>(optionTemplate); newOption.gameObject.SetActive(true); RectTransform r = newOption.GetComponent <RectTransform>(); r.SetParent(content, false); options.Add(newOption); subLists.Add(null); } newOption.Text.text = name; return(newOption); }