Answers for "adding a function with a parameter to a button Unity"

0

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
      }
Posted by: Guest on February-14-2021

Code answers related to "adding a function with a parameter to a button Unity"

Browse Popular Code Answers by Language