WaveVR_ControllerInstanceManager (new in SDK 3.0)



WaveVR_ControllerInstanceManager is a new feature of WaveVR SDK 3.0. It is a singleton component and is attached to an unable destroy gameobject, and it hold controllers registered by controller loader or customed controller calling registerControllerInstance() API. And remove controller after calling removeControllerInstance() API.

This manages visual ability of beam, controller pointer of connected controller, and decides if this controller is able to send button event to interact with other objects.

The priority of taking right of controll is

  1. Only 1 connected controller.
  2. Will use dominant controller if there are 2 or more controllers.
  3. Controller will change controll right by pressing Trigger key if this controller lost of controll right.

WaveVR_ControllerInstanceManager provided following APIs to use:

  • WaveVR_ControllerInstanceManager Instance

This is a static member to get a singleton WaveVR_ControllerInstanceManager component.

  • int registerControllerInstance(WVR_DeviceType type, GameObject controller)

Register controller instance and return controller index.

  • void removeControllerInstance(int index)

Remove controller instance if index is exist.

Sample Scene

  • ControllerInstanceMgr_Test: in Assets/Samples/ControllerInstanceMgr_Test/scenes/


Prefabs ControllerInstanceManager in Assets/WaveVR/Resources/

Script WaveVR_ControllerInstanceManager.cs in Assets/WaveVR/Scripts/ControllerModel/

How to Use

WaveVR_ControllerLoader will automatic create ControllerInstanceManager game object and register controller instance when loaded controller model, if you want to apply ControllerInstanceManager policy, please

  1. Use WaveVR_ControllerInstanceManager Instance function to get a singleton component.
  2. Register controller instance when connected.
  3. Remove controller instance when disconnected (Note: controller instance will be destroyed when scene switch, remember to remove controller instance from ControllerInstanceManager).

How to register controller

CtrInstanceMgr = WaveVR_ControllerInstanceManager.Instance;
if (CtrInstanceMgr != null)
    WVR_DeviceType _type = this.deviceType == WaveVR_Controller.EDeviceType.Dominant ?
        WVR_DeviceType.WVR_DeviceType_Controller_Right : WVR_DeviceType.WVR_DeviceType_Controller_Left;
    ControllerIdx = CtrInstanceMgr.registerControllerInstance(_type, controllerPrefab);
    Debug.Log("Type: " + _type + " controller index: " + ControllerIdx);

How to remove controller

CtrInstanceMgr = WaveVR_ControllerInstanceManager.Instance;
if (CtrInstanceMgr != null)