- Home /
Question by
Deimo08 · Nov 18, 2014 at 04:04 PM ·
canvassimulationsimulatorsimulate
Simulate canvas button click
Hello, i wanted to ask, if it is possible to simulate a click on a canvas button script based. I need to call the functions that the On Click event has.
Comment
Answer by vptb · Nov 18, 2014 at 05:07 PM
As far as I know you can't retrieve the functions that are there, but you can simulate the click by calling:
testButton.onClick.Invoke();
Answer by Hsni · Jun 25, 2018 at 12:30 PM
var pointer = new PointerEventData (EventSystem.current); ExecuteEvents.Execute (myButton.gameObject , pointer , ExecuteEvents.pointerClickHandler);