+ 2

How to change window game controls into android controls

hi guys yesterday am make my own first game which is very simple and am put some controls like when we press d it goes to right and if I press a it goes to left . but now am want to change this game into Android game how can I change controls from pressing a and d to touch left side to go left or touch right side to go right or how to create two button for it.plz help me. ( it's a cube game and cube goes forward automatically)

15th Nov 2017, 8:07 AM
sandeep
sandeep - avatar
1 Antwort
+ 5
this may help you.... void Update () { if (Input.touchCount > 0) { var touch = Input.GetTouch(0); if (touch.position.x < Screen.width/2) { Debug.Log ("Left click"); } else if (touch.position.x > Screen.width/2) { Debug.Log ("Right click"); } } }
15th Nov 2017, 10:11 AM
Md. Nafis Ul Haque Shifat
Md. Nafis Ul Haque Shifat - avatar