public void OnPointerDown(PointerEventData eventData) { if (gameObject.name == "Left") { playerMove.SetMoveLeft(true); } else { playerMove.SetMoveLeft(false); } }
public void Update() { if (Input.touchCount > 0) { Touch touch = Input.GetTouch(0); Vector3 touchPosition = Camera.main.ScreenToWorldPoint(touch.position); if (touchPosition.x < 0) { playerMove.SetMoveLeft(true); } else { playerMove.SetMoveLeft(false); } } else { playerMove.StopMoving(); } }