Question by
MrAwesome343 · Jun 12, 2016 at 06:33 PM ·
movementbuttonmobile
How can I make an object move normally with a UI Button
I'm planning on making a mobile game, and I need the character to move. Normally to make an object move, I do this line of code:
float moveRight = (Inpute.GetAxis("Horizontal") * Time.deltaTime * speed);
transform.Translate(moveRight, 0, 0);
But, on mobile, you can't just push the A or D keys, so how do I get that to work if I click a UI button?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612082807im_/https://answers.unity.com/themes/thub/images/avi.jpg)