Dragging an object stops when second touch is applied to mobile screen
I have a GameObject that is drag-able (you drag the screen and the object rotates), but it seems the object can only be dragged when the touchcount on the screen is 1. As soon as a second finger touches the device screen the GameObject stops rotating. This is a problem because I have a button on the screen and I need to be able to rotate the game object and click the button at the same time.
The button uses 'IPointerDownHandler' and 'IPointerUpHandler' to detect if it is pressed or not (I'm not sure if that is relevant information or not).
The drag code is this (it rotates the game object):
void OnMouseDrag()
{
if(Input.mousePosition.x < ScreenWidth / 2)
{
Vector2 direction = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.forward);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, rotateSpeed * Time.deltaTime);
}
}
Does anyone know how I can drag the game object and press the button at the same time?
Thanks in advance.
Your answer
Follow this Question
Related Questions
Move two players in the same Screen (Input.TouchCount) 1 Answer
Android Touch - how to know on which camera i touch 0 Answers
Separate Input from Touch on GUI 0 Answers
Fire Android Soft-key twice - How can I dismiss a video on Android mobile correctly? 0 Answers
Handle custom touches (any way to SET input.Touches from another touch array?) 0 Answers