@@ -500,8 +500,18 @@ public bool runPlayerUpdatesInEditMode
500500 set => m_RunPlayerUpdatesInEditMode = value ;
501501 }
502502
503+ /// <summary>
504+ /// Number of active <see cref="InputEventTrace.ReplayController"/> instances currently replaying.
505+ /// When greater than zero, focus-based gating is bypassed so that replayed events reach the game
506+ /// regardless of Game View focus. This affects event routing (A), disabled-device discard (B),
507+ /// and UI module processing (C). See ISXB-1319.
508+ /// </summary>
509+ internal int m_ActiveReplayCount ;
510+
511+ internal bool isReplayActive => m_ActiveReplayCount > 0 ;
503512#endif // UNITY_EDITOR
504513
514+
505515 private bool gameIsPlaying =>
506516#if UNITY_EDITOR
507517 ( m_Runtime . isInPlayMode && ! UnityEditor . EditorApplication . isPaused ) || m_RunPlayerUpdatesInEditMode ;
@@ -512,7 +522,7 @@ public bool runPlayerUpdatesInEditMode
512522
513523 private bool gameHasFocus =>
514524#if UNITY_EDITOR
515- m_RunPlayerUpdatesInEditMode || applicationHasFocus || gameShouldGetInputRegardlessOfFocus ;
525+ m_RunPlayerUpdatesInEditMode || applicationHasFocus || gameShouldGetInputRegardlessOfFocus || isReplayActive ;
516526#else
517527 applicationHasFocus || gameShouldGetInputRegardlessOfFocus ;
518528#endif
@@ -3371,15 +3381,15 @@ private unsafe void ProcessEventBuffer(InputUpdateType updateType, ref InputEven
33713381
33723382 // If device is disabled, we let the event through only in certain cases.
33733383 // Removal and configuration change events should always be processed.
3374- if ( device != null && ! device . enabled &&
3384+ // During replay, allow events through for devices disabled due to background
3385+ // focus loss — the replay intentionally re-injects events for those devices.
3386+ if ( device != null && ! device . enabled && ! isReplayActive &&
33753387 currentEventType != DeviceRemoveEvent . Type &&
33763388 currentEventType != DeviceConfigurationEvent . Type &&
33773389 ( device . m_DeviceFlags & ( InputDevice . DeviceFlags . DisabledInRuntime |
33783390 InputDevice . DeviceFlags . DisabledWhileInBackground ) ) != 0 )
33793391 {
33803392#if UNITY_EDITOR
3381- // If the device is disabled in the backend, getting events for them
3382- // is something that indicates a problem in the backend so diagnose.
33833393 if ( ( device . m_DeviceFlags & InputDevice . DeviceFlags . DisabledInRuntime ) != 0 )
33843394 m_Diagnostics ? . OnEventForDisabledDevice ( currentEventReadPtr , device ) ;
33853395#endif
@@ -3410,7 +3420,6 @@ private unsafe void ProcessEventBuffer(InputUpdateType updateType, ref InputEven
34103420#endif
34113421 if ( ! shouldProcess )
34123422 {
3413- // Skip event if PreProcessEvent considers it to be irrelevant.
34143423 m_InputEventStream . Advance ( false ) ;
34153424 continue ;
34163425 }
0 commit comments