How to ignore touches on a layer
I'm making an android game in which you move the camera by dragging the screen and rotate it with a virtual joystick, the problem is when i use the joystick the camera moves. So, how can i ignore the touches on the joystick, which is on a different layer? I put the drag to move code below.
if (Input.touchCount != 0) { if (Input.touchCount == 1 ) { Touch touch = Input.GetTouch(0); Vector2 TouchVec = touch.deltaPosition; if (TouchVec.x >= 10 || TouchVec.y >= 10 || TouchVec.x <= -10 || TouchVec.y <= -10) { transform.position = new Vector3(Mathf.Clamp(transform.position.x - TouchVec.x, -150, 150), transform.position.y, Mathf.Clamp(transform.position.z - TouchVec.y, -100, 100)); } }
Comment