public void AddField(string name, Func <int> read, Action <int> write, string[] enumOptions) { var field = Instantiate(EnumField, transform); field.Label.text = name; field.Dropdown.OnClick += data => { var selected = read(); Dropdown.gameObject.SetActive(true); Dropdown.Clear(); for (int i = 0; i < enumOptions.Length; i++) { var index = i; Dropdown.AddOption(enumOptions[i], () => write(index), index == selected); } Dropdown.Show((RectTransform)field.Dropdown.transform); }; RefreshPropertyValues += () => field.Dropdown.Label.text = enumOptions[read()]; Properties.Add(field.gameObject); OnPropertyAdded?.Invoke(field.gameObject); }