@@ -206,26 +206,8 @@ private GenericOpenVRController GetOrAddController(XRNodeState xrNodeState)
206206 var pointers = RequestPointers ( controllerType , controllingHand ) ;
207207 var inputSource = InputSystem ? . RequestNewGenericInputSource ( $ "{ CurrentControllerType } Controller { controllingHand } ", pointers ) ;
208208
209- GenericOpenVRController detectedController = null ;
210-
211- switch ( CurrentControllerType )
212- {
213- case SupportedControllerType . GenericOpenVR :
214- detectedController = new GenericOpenVRController ( TrackingState . NotTracked , controllingHand , inputSource ) ;
215- break ;
216- case SupportedControllerType . ViveWand :
217- detectedController = new ViveWandController ( TrackingState . NotTracked , controllingHand , inputSource ) ;
218- break ;
219- case SupportedControllerType . ViveKnuckles :
220- detectedController = new ViveKnucklesController ( TrackingState . NotTracked , controllingHand , inputSource ) ;
221- break ;
222- case SupportedControllerType . OculusTouch :
223- detectedController = new OculusTouchController ( TrackingState . NotTracked , controllingHand , inputSource ) ;
224- break ;
225- case SupportedControllerType . OculusRemote :
226- detectedController = new OculusRemoteController ( TrackingState . NotTracked , controllingHand , inputSource ) ;
227- break ;
228- }
209+ GenericOpenVRController detectedController = Activator . CreateInstance ( controllerType ,
210+ TrackingState . NotTracked , controllingHand , inputSource , null ) as GenericOpenVRController ;
229211
230212 Debug . Assert ( detectedController != null ) ;
231213 detectedController ? . SetupConfiguration ( controllerType ) ;
0 commit comments