@@ -1072,8 +1072,10 @@ public class ReplayController : IDisposable
10721072 private double m_StartTimeAsPerRuntime ;
10731073 private int m_AllEventsByTimeIndex = 0 ;
10741074 private List < InputEventPtr > m_AllEventsByTime ;
1075+ #if UNITY_EDITOR
10751076 private bool m_ReplayBypassActive ;
10761077 private Action m_ClearReplayBypassCallback ;
1078+ #endif
10771079
10781080 internal ReplayController ( InputEventTrace trace)
10791081 {
@@ -1090,13 +1092,15 @@ public void Dispose()
10901092 {
10911093 InputSystem . onBeforeUpdate -= OnBeginFrame ;
10921094 finished = true ;
1095+ #if UNITY_EDITOR
10931096 EndReplayBypass ( ) ;
1094-
1097+ #endif
10951098 foreach ( var device in m_CreatedDevices )
10961099 InputSystem . RemoveDevice ( device ) ;
10971100 m_CreatedDevices = default ;
10981101 }
10991102
1103+ #if UNITY_EDITOR
11001104 // Signals InputManager to treat events as if game view has focus, bypassing
11011105 // editor focus routing that would otherwise defer pointer/keyboard events to
11021106 // editor updates where they reach the editor UI instead of the game.
@@ -1135,7 +1139,7 @@ private void EndReplayBypass()
11351139 -- InputSystem . s_Manager . m_ActiveReplayCount ;
11361140 }
11371141 }
1138-
1142+ #endif
11391143 /// <summary>
11401144 /// Replay events recorded from <paramref name="recordedDevice"/> on device <paramref name="playbackDevice"/>.
11411145 /// </summary>
@@ -1291,7 +1295,9 @@ public ReplayController Rewind()
12911295 public ReplayController PlayAllFramesOneByOne ( )
12921296 {
12931297 finished = false ;
1298+ #if UNITY_EDITOR
12941299 BeginReplayBypass ( ) ;
1300+ #endif
12951301 InputSystem . onBeforeUpdate += OnBeginFrame ;
12961302 return this ;
12971303 }
@@ -1310,7 +1316,9 @@ public ReplayController PlayAllFramesOneByOne()
13101316 public ReplayController PlayAllEvents ( )
13111317 {
13121318 finished = false ;
1319+ #if UNITY_EDITOR
13131320 BeginReplayBypass ( ) ;
1321+ #endif
13141322 try
13151323 {
13161324 while ( MoveNext ( true , out var eventPtr ) )
@@ -1355,7 +1363,9 @@ public ReplayController PlayAllEventsAccordingToTimestamps()
13551363
13561364 // Start playback.
13571365 finished = false ;
1366+ #if UNITY_EDITOR
13581367 BeginReplayBypass ( ) ;
1368+ #endif
13591369 m_StartTimeAsPerFirstEvent = - 1 ;
13601370 m_AllEventsByTimeIndex = - 1 ;
13611371 InputSystem . onBeforeUpdate += OnBeginFrame ;
@@ -1426,9 +1436,11 @@ private void Finished()
14261436 {
14271437 finished = true ;
14281438 InputSystem . onBeforeUpdate -= OnBeginFrame ;
1439+ #if UNITY_EDITOR
14291440 // Schedule bypass removal for after the next OnUpdate, so any events already
14301441 // queued into the native buffer this frame are still processed with the bypass active.
14311442 ScheduleEndReplayBypass ( ) ;
1443+ #endif
14321444 m_OnFinished ? . Invoke ( ) ;
14331445 }
14341446
0 commit comments