When you create a button using the UI System on Canvas, it has the On Click() function, where you can add things in. However, I want it to be an On Touch() function, where when a user on an iPad touches the button, it does the things that I add in the On Touch() box. How can I do that???
OnStart() {
your_button.onClick. AddListener(YourFunc);
}
void YourFunc(){
//do your thing here it's the same as onTouch()
}
Thank you so much! What does AddListener actually do? Does it make it so that if the button is clicked, that function runs? So I could do something like this, correct? :
OnStart() {
gameObject.onClick.AddListener(PauseGame);
}
void PauseGame() {
time.timeScale = 0f;
pauseMenu.sendMessage("OpenPauseGUI");
}