@@ -89,34 +89,29 @@ public static void UpdateCursorControl()
89
89
90
90
public static void SetEventSystem ( )
91
91
{
92
- // not overriding EventSystem for new InputSystem, dont seem to need to.
93
92
if ( InputManager . CurrentType == InputType . InputSystem )
94
93
return ;
95
94
96
- // Disable current event system object
97
- if ( m_lastEventSystem || EventSystem . current )
95
+ if ( EventSystem . current && EventSystem . current != UIManager . EventSys )
98
96
{
99
- if ( ! m_lastEventSystem )
100
- m_lastEventSystem = EventSystem . current ;
101
-
97
+ m_lastEventSystem = EventSystem . current ;
102
98
m_lastEventSystem . enabled = false ;
103
99
}
104
100
105
101
// Set to our current system
106
102
m_settingEventSystem = true ;
107
- EventSystem . current = UIManager . EventSys ;
108
103
UIManager . EventSys . enabled = true ;
104
+ EventSystem . current = UIManager . EventSys ;
109
105
InputManager . ActivateUIModule ( ) ;
110
106
m_settingEventSystem = false ;
111
107
}
112
108
113
109
public static void ReleaseEventSystem ( )
114
110
{
115
- // not overriding EventSystem for new InputSystem, dont seem to need to.
116
111
if ( InputManager . CurrentType == InputType . InputSystem )
117
112
return ;
118
113
119
- if ( m_lastEventSystem )
114
+ if ( m_lastEventSystem && m_lastEventSystem . gameObject . activeSelf )
120
115
{
121
116
m_lastEventSystem . enabled = true ;
122
117
@@ -153,13 +148,16 @@ private static void SetupPatches()
153
148
154
149
public static void Prefix_EventSystem_set_current ( ref EventSystem value )
155
150
{
156
- if ( ! m_settingEventSystem )
151
+ if ( ! m_settingEventSystem && value != UIManager . EventSys )
157
152
{
158
153
m_lastEventSystem = value ;
159
154
m_lastInputModule = value ? . currentInputModule ;
160
155
161
156
if ( ShouldActuallyUnlock )
157
+ {
162
158
value = UIManager . EventSys ;
159
+ value . enabled = true ;
160
+ }
163
161
}
164
162
}
165
163
0 commit comments