@@ -61,38 +61,39 @@ internal partial class InputManager : IDisposable
61
61
{
62
62
private InputManager ( ) { }
63
63
64
- public static InputManager CreateAndInitialize ( IInputRuntime runtime , InputSettings settings , bool fakeRemove = false )
64
+ public static InputManager CreateAndInitialize ( IInputRuntime runtime , InputSettings settings , bool fakeManagerForRemotingTests = false )
65
65
{
66
- var newInst = new InputManager ( ) ;
66
+ var newInstance = new InputManager ( ) ;
67
67
68
68
// Not directly used by InputManager, but we need a single instance that's used in a variety of places without a static field
69
- newInst . m_DeferBindingResolutionContext = new DeferBindingResolutionContext ( ) ;
69
+ newInstance . m_DeferBindingResolutionContext = new DeferBindingResolutionContext ( ) ;
70
70
71
71
// If settings object wasn't provided, create a temporary settings object for now
72
72
if ( settings == null )
73
73
{
74
74
settings = ScriptableObject . CreateInstance < InputSettings > ( ) ;
75
75
settings . hideFlags = HideFlags . HideAndDontSave ;
76
76
}
77
- newInst . m_Settings = settings ;
77
+ newInstance . m_Settings = settings ;
78
78
79
79
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
80
- newInst . InitializeActions ( ) ;
80
+ newInstance . InitializeActions ( ) ;
81
81
#endif // UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
82
82
83
- newInst . InitializeData ( ) ;
84
- newInst . InstallRuntime ( runtime ) ;
83
+ newInstance . InitializeData ( ) ;
84
+ newInstance . InstallRuntime ( runtime ) ;
85
85
86
- // Skip if initializing for "Fake Remove" manager (in tests)
87
- if ( ! fakeRemove )
88
- newInst . InstallGlobals ( ) ;
86
+ // For remoting tests, we need to create a "fake manager" that simulates a remote endpoint.
87
+ // In this case don't install globals as this will corrupt the "local" manager state.
88
+ if ( ! fakeManagerForRemotingTests )
89
+ newInstance . InstallGlobals ( ) ;
89
90
90
- newInst . ApplySettings ( ) ;
91
+ newInstance . ApplySettings ( ) ;
91
92
92
93
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
93
- newInst . ApplyActions ( ) ;
94
+ newInstance . ApplyActions ( ) ;
94
95
#endif
95
- return newInst ;
96
+ return newInstance ;
96
97
}
97
98
98
99
#region Dispose implementation
@@ -3985,7 +3986,7 @@ internal void RestoreStateWithoutDevices(SerializedState state)
3985
3986
if ( state . settings == null )
3986
3987
{
3987
3988
state . settings = ScriptableObject . CreateInstance < InputSettings > ( ) ;
3988
- state . settings . hideFlags = HideFlags . HideAndDontSave ;
3989
+ state . settings . hideFlags = HideFlags . HideAndDontSave ; // Hide from the project Hierarchy and Scene
3989
3990
}
3990
3991
3991
3992
if ( m_Settings != null && m_Settings != state . settings )
0 commit comments