First time coding in C#, Little confused as to why my method is never being called.
I believe the error line to be the following, after searching online I cannot pinpoint my problem.
Rumbler.onClick.AddListener(TaskOnClick(1));
public class SirenController : MonoBehaviour
{
public Button RMBLR;
public Button AIR_HORN;
public Button MAN;
public Button WAIL;
public Button YELP;
public Button PRTY;
void Start()
{
Button Rumbler = RMBLR.GetComponent<Button>();
Rumbler.onClick.AddListener(TaskOnClick(1));
}
void TaskOnClick(int number)
{
switch (number)
{
case 1:
break;
default:
break;
}
}
}
Thank you for your help.