- Home /
Cannot get Image-based Touch Controller to Work
Folks,
I'm trying to implement a rather simple touch controller for my game. Below screenshot shows the hierarchy of my Canvas, where 'MoveControlGroup' is just an empty object to hold various UI elements and 'Forward' is Image that is supposed to be the touch controller to make the player move forward when it is pressed down:
Below screenshot shows the Inspector view of the 'Forward' image:
As you can see, I attached an Event Trigger that detects the 'Pointer Down' event, which should be equivalent to a finger pressed-down action and this event is tied to 'PlayerController.MoveForward' function. And the 'MoveForward' function only has one line of code in it as follows:
print("I'm moving forward!");So, quite obviously, the expected end result is when I left clicked the image-based controller and keep the mouse button pressed down, I should see the "I'm moving forward!" message being printed in the console. But I don't see a single instance of it.
I struggled with this for hours now and just can't seem to figure out what I could be doing wrong.
(By the way, this approach is based on Devin Curry's excellent tutorial on "Touch Input Buttons")
Verify you actually have an "Event System" gameobject and that it's active. I've wasted a bit of time myself banging my head on that wall only to find it was somehow gone.
@getyour411 - Yes, the EventSystem object is in place and active. So is the Touch Input $$anonymous$$odule component.
Your answer

Follow this Question
Related Questions
Make touch buttons transparent 2 Answers
How to select an ui image with mouse click and touch? 1 Answer
Pressing two on-screen buttons at the same time, with the same touch - Android Unity Event-Triggers 0 Answers
Adding animation to UI buttons? 0 Answers
Make touch buttons stop working after finger slides off. 1 Answer