- Home /
Question by
Caieu · Jan 05, 2017 at 03:41 PM ·
uieventeventsystemevent triggering
Can't fire a Custom Event on UI Button Touch OnClick
Hey Everybody.
I created a Custom event on my HUDManager to fire when the user clicks on the button:
public delegate void HUDManagerEventHandler();
public static event HUDManagerEventHandler OnClickDrawPath;
So, when user click in the button, i call this method (with the event fire):
public void StartDraw ()
{
drawPathButton.SetActive(false);
OnClickDrawPath();
}
So, when i click with mouse on editor, the event OnClickDrawPath is fired, but when i touch the button, via Unity Remote or Android Build, nothing happpens.
How can i make the touch also fire the event?
Comment
Answer by RobAnthem · Jan 05, 2017 at 05:56 PM
You need to include an event system and a canvas that contains a mobile control rig in every scene.