File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Assets/MixedRealityToolkit.Providers/WindowsMixedReality Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -269,6 +269,8 @@ public override void Enable()
269269
270270 interactionmanagerStates = InteractionManager . GetCurrentReading ( ) ;
271271
272+ // Avoids a Unity Editor bug detecting a controller from the previous run during the first frame
273+ #if ! UNITY_EDITOR
272274 // NOTE: We update the source state data, in case an app wants to query it on source detected.
273275 for ( var i = 0 ; i < interactionmanagerStates ? . Length ; i ++ )
274276 {
@@ -280,6 +282,7 @@ public override void Enable()
280282 MixedRealityToolkit . InputSystem ? . RaiseSourceDetected ( controller . InputSource , controller ) ;
281283 }
282284 }
285+ #endif
283286
284287 if ( MixedRealityToolkit . Instance . ActiveProfile . IsInputSystemEnabled &&
285288 MixedRealityToolkit . Instance . ActiveProfile . InputSystemProfile . GesturesProfile != null &&
@@ -466,6 +469,15 @@ private void RemoveController(InteractionSource interactionSource)
466469 /// <param name="args">SDK source detected event arguments</param>
467470 private void InteractionManager_InteractionSourceDetected ( InteractionSourceDetectedEventArgs args )
468471 {
472+
473+ // Avoids a Unity Editor bug detecting a controller from the previous run during the first frame
474+ #if UNITY_EDITOR
475+ if ( Time . frameCount <= 1 )
476+ {
477+ return ;
478+ }
479+ #endif
480+
469481 bool raiseSourceDetected = ! activeControllers . ContainsKey ( args . state . source . id ) ;
470482
471483 var controller = GetController ( args . state . source ) ;
You can’t perform that action at this time.
0 commit comments