TouchPhase.Stationary firing while moving
Hello,
I noticed that TouchPhase.Stationary is firing while I am in the middle of a swipe. Can someone help explain why this is happening? I would expect TouchPhase.Move to be the only thing going off during the whole swipe motion. I clear the trail renderer when a new swipe starts, but because stationary is being called unexpectedly, my code clears the trail mid-swipe and I am left with only a semi-complete trail. I have tested this with two devices and the issue happens on both.
I believe I found a workaround, where I change the last "else" to an "else if" that checks for TouchPhase.End in the original code below, but I would still like to know why stationary is called while I am mid swipe. Thank you in advance for the help.
void Start(){
trail = GetComponent<TrailRenderer> ();
}
void Update(){
foreach (Touch touch in Input.touches) {
if (touch.phase == TouchPhase.Moved) {
if (currentTouchId > -1 && currentTouchId != touch.fingerId) {
continue;
}
if(currentTouchId < 0 ){// && touch.fingerId != prevTouchId){
trail.Clear();
}
prevPosition = this.transform.position;
currentTouchId = touch.fingerId;
return;
} else {
if (currentTouchId != touch.fingerId) {
continue;
}
Debug.Log ("touch phase: " + touch.phase);
currentTouchId = -1;
}
}
}
Your answer
Follow this Question
Related Questions
How to pick up an object when touching a button(Mobile) 0 Answers
Non-responsive touch controls after showing ads. 0 Answers
Replace TouchPhase.Ended with booleans? 1 Answer
Massive lag spike on first Input.GetTouch with nothing on scene but one script (Android) 2 Answers
Having an issue with touch input lag on certain Android devices, any help? 1 Answer