void UpdateTouches(ulong updateTick, float deltaTime) { activeTouches.Clear(); cachedTouches.FreeEndedTouches(); #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_WSA if (mouseTouch.SetWithMouseData(updateTick, deltaTime)) { activeTouches.Add(mouseTouch); } #endif for (var i = 0; i < Input.touchCount; i++) { var unityTouch = Input.GetTouch(i); var cacheTouch = cachedTouches.FindOrCreateTouch(unityTouch.fingerId); cacheTouch.SetWithTouchData(unityTouch, updateTick, deltaTime); activeTouches.Add(cacheTouch); } // Find any touches that Unity may have "forgotten" to end properly. var touchCount = cachedTouches.Touches.Count; for (var i = 0; i < touchCount; i++) { var touch = cachedTouches.Touches[i]; if (touch.phase != TouchPhase.Ended && touch.updateTick != updateTick) { touch.phase = TouchPhase.Ended; activeTouches.Add(touch); } } InvokeTouchEvents(); }
private void UpdateTouches(ulong updateTick, float deltaTime) { activeTouches.Clear(); cachedTouches.FreeEndedTouches(); if (mouseTouch.SetWithMouseData(updateTick, deltaTime)) { activeTouches.Add(mouseTouch); } for (int i = 0; i < Input.touchCount; i++) { UnityEngine.Touch touch = Input.GetTouch(i); Touch touch2 = cachedTouches.FindOrCreateTouch(touch.fingerId); touch2.SetWithTouchData(touch, updateTick, deltaTime); activeTouches.Add(touch2); } int count = cachedTouches.Touches.Count; for (int j = 0; j < count; j++) { Touch touch3 = cachedTouches.Touches[j]; if (touch3.phase != TouchPhase.Ended && touch3.updateTick != updateTick) { touch3.phase = TouchPhase.Ended; activeTouches.Add(touch3); } } InvokeTouchEvents(); }
static void UpdateTouches(ulong updateTick, float deltaTime) { activeTouches.Clear(); if (mouseTouch.SetWithMouseData(updateTick, deltaTime)) { activeTouches.Add(mouseTouch); } for (int i = 0; i < Input.touchCount; i++) { var unityTouch = Input.GetTouch(i); var cacheTouch = cachedTouches[unityTouch.fingerId]; cacheTouch.SetWithTouchData(unityTouch, updateTick, deltaTime); activeTouches.Add(cacheTouch); } // Find any touches that Unity may have "forgotten" to end properly. for (int i = 0; i < MaxTouches; i++) { var touch = cachedTouches[i]; if (touch.phase != TouchPhase.Ended && touch.updateTick != updateTick) { touch.phase = TouchPhase.Ended; activeTouches.Add(touch); } } InvokeTouchEvents(); var touchControlCount = touchControls.Count; for (int i = 0; i < touchControlCount; i++) { touchControls[i].SubmitControlState(updateTick); } }