call function button with parameter unity code example
Example: adding a function with a parameter to a button Unity
void Start ()
{
ButtonPre.onClick.AddListener(delegate{SwitchButtonHandler(0);});
ButtonNext.onClick.AddListener(delegate{SwitchButtonHandler(1);});
}
void SwitchButtonHandler(int idx_)
{
//Here i want to know which button was Clicked.
//or how to pass a param through addListener
}