I have some problems with Unity touch input system on my Windows Phone 8 device
void Update ()
{
#if UNITY_WP8
for (int i = 0; i < fingers.Length; i++)
{
if (i < Input.touchCount)
{
Vector3 inputVector = Input.GetTouch(i).position;
var currentFingerPosition =
Camera.main.ScreenToWorldPoint(new Vector3(inputVector.x, inputVector.y, depthZ));
if (Input.GetTouch(i).phase != TouchPhase.Ended Input.GetTouch(i).phase != TouchPhase.Canceled)
{
fingers[i].transform.position = currentFingerPosition;
}
else
{
fingers[i].transform.position = _originVector;
}
}
else
{
fingers[i].transform.position = _originVector;
}
}
#endif
}
where fingers[ ] is my prefabs with sprites for indicating touches (I use four of them).
_originVector is simple dummy vector (new Vector3(1000, 0, 0)) for indicator’s position reset
When I make very fast touches on device’s screen sometimes finger indicator is getting stuck. And after that it always shows input on screen in place where finger is stuck even if I don’t touch screen. (input.touchCount always greater than zero). It can unstuck if I repeat fast taps on screen. Help me please, and sorry for my english:)