-1

I'm starting with Unity 3D, and I'm trying to move player when a UI (not on keyboard) button is pressed down. But I cant work it out and i have done a lot of research.

  • 1
    make use of `EventSystem` : https://stackoverflow.com/q/41391708/366064 – Bizhan Aug 11 '18 at 20:08
  • It looks more like you need visual joystick than just a UI button. EventSystem can be use to implement visual joystick. See the two duplicate links – Programmer Aug 12 '18 at 01:53

1 Answers1

0

The easiest way for non complex tasks and without coding for the Button (works only if button and the Script for moving in the scene):

  • Select the button in the scene
  • On the Button component in the inspector you have a box OnClick() with a +
  • By pressing the plus you add a new field for a listner to react on the click
  • This gameobject has to hold your move script
  • After selecting the gamobject:
    • in the right drop down select your script for the movement on the gameobject and then choose the method for movement