Hello, I’m making a path drawing game and experiencing some lag with the input touches.
Sometimes you get a big gap between the points, when you quickly swipe a circle. I couldn’t find the reason for this, so I tested it on the normal android SDK and experienced a much more fluently touch input. Does anyone know if this a Unity3D related problem, or am I doing someting wrong? Below you can see the screenshots(i can;t manage to place them right here due to some bugs with posting images on the forum, so scroll a litte downwards in my post to see them). Also I provided some code and hope someone knows a solution for this
function Update ()
{
if(Input.touchCount == 1)
{
// touch on screen
if(Input.GetTouch(0).phase == TouchPhase.Began)
{
pos = Input.GetTouch(0).position;
ray = Camera.main.ScreenPointToRay(pos);
if (Physics.Raycast (ray, hit, 50) )
hit.transform.gameObject.SendMessage("TouchBegan") ;
}
if(Input.GetTouch(0).phase == TouchPhase.Moved)
{
pos = Input.GetTouch(0).position;
// pos = Camera.main.ScreenToWorldPoint(pos);
hit.transform.gameObject.SendMessage("TouchMoved", pos);
}
if (Input.GetTouch(0).phase == TouchPhase.Ended || Input.GetTouch(0).phase == TouchPhase.Canceled)
{
hit.transform.gameObject.SendMessage("TouchEnded") ;
}
}
}
The first screenshot is from Unity, the second is from Android: