Hi. I wanted to write a class deriving from new UI elements hoping my extensions would show up in the Inspector but they don’t show up in the Inspector. Here is my code:
[Serializable]
public class ResponsiveText : Text {
public ResponsiveText() : base() { }
new public string text {
get { return base.text; }
set {
base.text = value;
OnValueChanged.Invoke(value);
}
}
public ResponsiveText.OnChangeEvent OnValueChanged { get; set; }
public string Dummy { get; set; }
[Serializable]
public class OnChangeEvent : UnityEvent<string> {
public OnChangeEvent() : base(){ }
}
}
This basically would call OnValueChanged event when text changes. When I attach this to a GameObject Inspector shows it just like Text. I was hoping OnValueChanged event would show in the Inspector as in InputField. Even Dummy doesn’t show up. Is there a way to do what I want? If not, is there a way I can call this event from EventTrigger?