@@ -257,6 +257,9 @@ protected void OnEnable()
257257            if  ( m_Touches  ==  null ) 
258258                m_Touches  =  new  ButtonControl [ simulatedTouchscreen . touches . Count ] ; 
259259
260+             if  ( m_TouchIds  ==  null ) 
261+                 m_TouchIds  =  new  int [ simulatedTouchscreen . touches . Count ] ; 
262+ 
260263            foreach  ( var  device  in  InputSystem . devices ) 
261264                OnDeviceChange ( device ,  InputDeviceChange . Added ) ; 
262265
@@ -309,10 +312,11 @@ private unsafe void UpdateTouch(int touchIndex, int pointerIndex, TouchPhase pha
309312                touch . startTime  =  eventPtr . valid  ?  eventPtr . time  :  InputState . currentTime ; 
310313                touch . startPosition  =  position ; 
311314                touch . touchId  =  ++ m_LastTouchId ; 
315+                 m_TouchIds [ touchIndex ]  =  m_LastTouchId ; 
312316            } 
313317            else 
314318            { 
315-                 touch . touchId  =  m_LastTouchId ; 
319+                 touch . touchId  =  m_TouchIds [ touchIndex ] ; 
316320            } 
317321
318322            //NOTE: Processing these events still happen in the current frame. 
@@ -329,6 +333,7 @@ private unsafe void UpdateTouch(int touchIndex, int pointerIndex, TouchPhase pha
329333        [ NonSerialized ]  private  Vector2 [ ]  m_CurrentPositions ; 
330334        [ NonSerialized ]  private  int [ ]  m_CurrentDisplayIndices ; 
331335        [ NonSerialized ]  private  ButtonControl [ ]  m_Touches ; 
336+         [ NonSerialized ]  private  int [ ]  m_TouchIds ; 
332337
333338        [ NonSerialized ]  private  int  m_LastTouchId ; 
334339        [ NonSerialized ]  private  Action < InputDevice ,  InputDeviceChange >  m_OnDeviceChange ; 
0 commit comments