I've seen this topic covered in a few different places in the forum, but wanted a bit more clarification on when to use a certain one and their performance implications (just for good general practice really).
So:
I've read that UIEventListener.Get is used for remote events (i.e. in a config script where you assign delegates to several buttons). Therefore I guess it maybe beneficial if you have a lot of buttons that do the same thing to do:
void OnEnable()
{
foreach(UIButton b in m_buttons)
{
UIEventListener.Get(b.gameObject).onClick += HandleButton;
}
}
Although minimal, would the b.gameObject (which I guess is effectively b.GetComponent<GameObject>()) cause a problem if the loop was carried out on a large number of buttons?
My first thought when using buttons was to do:
void OnEnable()
{
myButton.onClick += HandleMyButtonClick();
}
However, that wasn't the right way to do it, as onClick uses a List<EventDelegate> so my next step was to try myButton.onClick.Add(Delegate), which also wasn't right

So, I came full circle and thought why not just add the monobehaviour scripts to the on click property in the inspector (something I was a bit reluctant to do, as I thought it may use reflection or SendMessage and thus affect performance).
So question time:
Is it just best to use the on click property in the inspector and select a delegate? Will this affect performance (via SendMessage / Reflection, if it uses them that is)?
If so should I use UIEventListener.Get instead? Seems like I should just use the inspector property the majority of the time, but would like to know either way just for best practice when setting up my UI.
Thanks in advance
