// Use this for initialization void Start() { gameObject.GetComponent <Dropdown>().onValueChanged.AddListener(changetext); for (int i = 1; i < this.GetComponent <Dropdown>().options.Count; i++) { Script_ObjectItem tempobjectsitems = new Script_ObjectItem(); tempobjectsitems.name = this.GetComponent <Dropdown> ().options.ToArray() [i].ToString(); tempobjectsitems.rules = null; objectsitems.Add(tempobjectsitems); objectnum++; } }
public void addObject(GameObject inputfield) { List <string> newoption = new List <string>(); string newobject = inputfield.GetComponent <InputField> ().text; if (newobject != null) { newoption.Add(newobject); gameObject.GetComponent <Dropdown>().AddOptions(newoption); Script_ObjectItem newscrip_obj = new Script_ObjectItem(); newscrip_obj.name = newobject; newscrip_obj.rules = null; this.objectsitems.Add(newscrip_obj); objectnum++; } }