@@ -144,7 +144,7 @@ public void Set(T e, string pathName, string alias)
144144 {
145145 var index = EqualityComparer < T > . Default . GetHashCode ( e ) - s_enumInfo . minValue ;
146146 m_aliases [ index ] = alias ;
147- m_paths [ index ] = ACTION_SET_NAME + m_pathPrefix + pathName ;
147+ m_paths [ index ] = ACTION_SET_PATH + m_pathPrefix + pathName ;
148148 }
149149
150150 public void InitiateHandles ( CVRInput vrInput )
@@ -158,7 +158,8 @@ public void InitiateHandles(CVRInput vrInput)
158158
159159 public enum HapticStruct { Haptic }
160160
161- public const string ACTION_SET_NAME = "/actions/htc_viu" ;
161+ public const string ACTION_SET_NAME = "htc_viu" ;
162+ public const string ACTION_SET_PATH = "/actions/" + ACTION_SET_NAME ;
162163
163164 private static bool s_pathInitialized ;
164165 private static bool s_actionInitialized ;
@@ -306,7 +307,7 @@ public static void InitializeHandles()
306307 v2Actions . InitiateHandles ( vrInput ) ;
307308 vibrateActions . InitiateHandles ( vrInput ) ;
308309
309- s_actionSetHandle = SafeGetActionSetHandle ( vrInput , ACTION_SET_NAME ) ;
310+ s_actionSetHandle = SafeGetActionSetHandle ( vrInput , ACTION_SET_PATH ) ;
310311 }
311312
312313 private static ulong SafeGetActionSetHandle ( CVRInput vrInput , string path )
@@ -376,9 +377,15 @@ public override void OnActivated()
376377 m_gamePoses = new TrackedDevicePose_t [ 0 ] ;
377378 m_originDataCache = new Dictionary < ulong , OriginData > ( ( int ) OpenVR . k_unMaxActionOriginCount ) ;
378379
380+ #if VIU_STEAMVR_2_1_0_OR_NEWER
381+ SteamVR_Input . GetActionSet ( ACTION_SET_NAME ) . Activate ( SteamVR_Input_Sources . Any , 0 , false ) ;
382+ #endif
383+
379384 InitializeHandles ( ) ;
380385
386+ #if ! VIU_STEAMVR_2_1_0_OR_NEWER
381387 m_activeActionSets = new VRActiveActionSet_t [ 1 ] { new VRActiveActionSet_t ( ) { ulActionSet = s_actionSetHandle , } } ;
388+ #endif
382389
383390#if VIU_STEAMVR_2_2_0_OR_NEWER
384391 SteamVR_Input . onNonVisualActionsUpdated += UpdateDeviceInput ;
@@ -441,12 +448,14 @@ private void UpdateDeviceInput()
441448 }
442449 else
443450 {
451+ #if ! VIU_STEAMVR_2_1_0_OR_NEWER
444452 // FIXME: Should update by SteamVR_Input? SteamVR_Input.GetActionSetFromPath(ACTIONSET_PATH).ActivatePrimary();
445453 error = vrInput . UpdateActionState ( m_activeActionSets , m_activeActionSetSize ) ;
446454 if ( error != EVRInputError . None )
447455 {
448456 Debug . LogError ( "UpdateActionState failed! " + ACTION_SET_NAME + " error=" + error ) ;
449457 }
458+ #endif
450459
451460 m_originDataCache . Clear ( ) ;
452461
@@ -696,5 +705,5 @@ public override void TriggerHapticVibration(uint deviceIndex, float durationSeco
696705 }
697706 }
698707#endif
708+ }
699709 }
700- }
0 commit comments