File tree 3 files changed +22
-6
lines changed
Packages/com.unity.inputsystem/InputSystem
3 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -4234,6 +4234,13 @@ internal struct GlobalState
4234
4234
4235
4235
internal static GlobalState s_GlobalState ;
4236
4236
4237
+ [ RuntimeInitializeOnLoadMethod ( RuntimeInitializeLoadType . BeforeSceneLoad ) ]
4238
+ private static void InitializeGlobalActionState ( )
4239
+ {
4240
+ ResetGlobals ( ) ;
4241
+ s_GlobalState = default ;
4242
+ }
4243
+
4237
4244
internal static ISavedState SaveAndResetState ( )
4238
4245
{
4239
4246
// Save current state
Original file line number Diff line number Diff line change @@ -593,12 +593,14 @@ internal struct GlobalState
593
593
#endif
594
594
}
595
595
596
- private static GlobalState CreateGlobalState ( )
597
- { // Convenient method since parameterized construction is default
598
- return new GlobalState { historyLengthPerFinger = 64 } ;
599
- }
596
+ internal static GlobalState s_GlobalState ;
600
597
601
- internal static GlobalState s_GlobalState = CreateGlobalState ( ) ;
598
+ [ RuntimeInitializeOnLoadMethod ( RuntimeInitializeLoadType . BeforeSceneLoad ) ]
599
+ private static void InitializeGlobalTouchState ( )
600
+ {
601
+ // Touch GlobalState doesn't require Dispose operations
602
+ s_GlobalState = new GlobalState { historyLengthPerFinger = 64 } ;
603
+ }
602
604
603
605
internal static ISavedState SaveAndResetState ( )
604
606
{
@@ -609,7 +611,7 @@ internal static ISavedState SaveAndResetState()
609
611
( ) => { /* currently nothing to dispose */ } ) ;
610
612
611
613
// Reset global state
612
- s_GlobalState = CreateGlobalState ( ) ;
614
+ InitializeGlobalTouchState ( ) ;
613
615
614
616
return savedState ;
615
617
}
Original file line number Diff line number Diff line change @@ -1873,6 +1873,13 @@ private struct GlobalState
1873
1873
1874
1874
private static GlobalState s_GlobalState ;
1875
1875
1876
+ [ RuntimeInitializeOnLoadMethod ( RuntimeInitializeLoadType . BeforeSceneLoad ) ]
1877
+ private static void InitializeGlobalUserState ( )
1878
+ {
1879
+ ResetGlobals ( ) ;
1880
+ s_GlobalState = default ;
1881
+ }
1882
+
1876
1883
internal static ISavedState SaveAndResetState ( )
1877
1884
{
1878
1885
// Save current state and provide an opaque interface to restore it
You can’t perform that action at this time.
0 commit comments