- Home /
Best way to move a player (touch based) using the event system in Unity 5?
As the title says, I want to migrate my player movement to use the new Event System in Unity 5.
In my current project, I use Physics.raycast
to determine if the player has tapped/clicked on the ground and tell my player controller to navigate to this point.
Since I read somewhere in the forum that it's better to use the EventSystem
to handle interactions with the world in order for the UI to consume clicks; I was wondering what is the best way to achieve this?
I can only think of 2 ways to implement it that doesn't sound too good.
Put a
Ground
script on every ground gameObject and make it implementIPointerDownHandler
to receive the event and notify the player.Make a big "invisible box" in front of the camera that will receive events using
IPointerDownHandler
on which I have to perform a raycast to check the object behind the pointer.
Your answer
Follow this Question
Related Questions
How do I close in the distance between the player and object to pick up? 0 Answers
How to get input events working on MaskableGraphic correctly 1 Answer
EventTrigger Submit 0 Answers
Buttons stopped working after I temporarily changed the font. 1 Answer
Prevent multiple UI elements receiving input from different pointers? 2 Answers