@@ -160,7 +160,7 @@ public static string StaticCurrentMode
160160 /// <summary>
161161 /// Registered device SDK managers capable of booting into given modes (Desktop/XR/etc.).
162162 /// </summary>
163- [ SerializeField ] public List < BasisBaseTypeManagement > BaseTypes = new ( ) ;
163+ [ SerializeField ] public BasisBaseTypeManagement [ ] BaseTypes ;
164164
165165 /// <summary>
166166 /// Helpers that constrain transforms to input devices.
@@ -264,7 +264,7 @@ private async void OnDestroy()
264264 public void Simulate ( )
265265 {
266266 OnDeviceManagementLoop ? . Invoke ( ) ;
267- int Count = BaseTypes . Count ;
267+ int Count = BaseTypes . Length ;
268268 for ( int Index = 0 ; Index < Count ; Index ++ )
269269 {
270270 BasisBaseTypeManagement Sim = BaseTypes [ Index ] ;
@@ -450,7 +450,8 @@ public async Task StartDevices(string mode)
450450 /// </summary>
451451 public void StopAllDevices ( )
452452 {
453- for ( int i = 0 ; i < BaseTypes . Count ; i ++ )
453+ var length = BaseTypes . Length ;
454+ for ( int i = 0 ; i < length ; i ++ )
454455 {
455456 BaseTypes [ i ] ? . AttemptStopSDK ( ) ;
456457 }
@@ -477,7 +478,8 @@ public void ShutDownXR()
477478 /// </summary>
478479 public void StartAllStartIfPermanentlyExists ( )
479480 {
480- for ( int i = 0 ; i < BaseTypes . Count ; i ++ )
481+ var length = BaseTypes . Length ;
482+ for ( int i = 0 ; i < length ; i ++ )
481483 {
482484 BaseTypes [ i ] ? . StartIfPermanentlyExists ( ) ;
483485 }
@@ -507,9 +509,13 @@ public static void UnassignFBTrackers()
507509 public bool TryFindBasisBaseTypeManagement ( string name , out List < BasisBaseTypeManagement > match , bool OnlyFinding = false )
508510 {
509511 match = new List < BasisBaseTypeManagement > ( ) ;
510- if ( string . IsNullOrEmpty ( name ) || BaseTypes == null ) return false ;
512+ if ( string . IsNullOrEmpty ( name ) || BaseTypes == null )
513+ {
514+ return false ;
515+ }
511516
512- for ( int i = 0 ; i < BaseTypes . Count ; i ++ )
517+ var length = BaseTypes . Length ;
518+ for ( int i = 0 ; i < length ; i ++ )
513519 {
514520 var type = BaseTypes [ i ] ;
515521 if ( type != null && type . AttemptIsDeviceBootable ( name , OnlyFinding ) )
@@ -888,8 +894,9 @@ public async Task SoftSwitchToDesktop()
888894
889895 BasisDebug . Log ( $ "Soft-switching from { AutoSwapPreviousVRMode } to Desktop (keeping runtime alive)", BasisDebug . LogTag . Device ) ;
890896
897+ var length = BaseTypes . Length ;
891898 // Soft-stop VR input devices — runtime stays alive
892- for ( int i = 0 ; i < BaseTypes . Count ; i ++ )
899+ for ( int i = 0 ; i < length ; i ++ )
893900 {
894901 var bt = BaseTypes [ i ] ;
895902 if ( bt != null && bt . IsDeviceBooted && bt . IsDeviceBootable ( AutoSwapPreviousVRMode ) )
@@ -925,8 +932,9 @@ public async Task SoftSwitchToVR()
925932
926933 BasisDebug . Log ( $ "Soft-switching from Desktop back to { vrMode } ", BasisDebug . LogTag . Device ) ;
927934
935+ var length = BaseTypes . Length ;
928936 // Stop desktop devices normally
929- for ( int i = 0 ; i < BaseTypes . Count ; i ++ )
937+ for ( int i = 0 ; i < length ; i ++ )
930938 {
931939 var bt = BaseTypes [ i ] ;
932940 if ( bt != null && bt . IsDeviceBooted && bt . IsDeviceBootable ( BasisConstants . Desktop ) )
@@ -941,7 +949,7 @@ public async Task SoftSwitchToVR()
941949 BasisCursorManagement . OnReset ( ) ;
942950
943951 // Soft-start VR input devices — runtime is already alive
944- for ( int i = 0 ; i < BaseTypes . Count ; i ++ )
952+ for ( int i = 0 ; i < length ; i ++ )
945953 {
946954 var bt = BaseTypes [ i ] ;
947955 if ( bt != null && bt . IsDeviceBooted && bt . IsDeviceBootable ( vrMode ) )
0 commit comments