Please Select Your Location
Australia
Österreich
België
Canada
Canada - Français
中国
Česká republika
Denmark
Deutschland
France
HongKong
Iceland
Ireland
Italia
日本
Korea
Latvija
Lietuva
Lëtzebuerg
Malta
المملكة العربية السعودية (Arabic)
Nederland
New Zealand
Norge
Polska
Portugal
Russia
Saudi Arabia
Southeast Asia
España
Suisse
Suomi
Sverige
台灣
Ukraine
United Kingdom
United States
Please Select Your Location
België
Česká republika
Denmark
Iceland
Ireland
Italia
Latvija
Lietuva
Lëtzebuerg
Malta
Nederland
Norge
Polska
Portugal
España
Suisse
Suomi
Sverige

How do I show or hide the controller pointer?

The WaveVR controller pointer is created by WaveVR_ControllerPointer.cs and is shown by default. You can choose to show or hide the pointer in runtime.
Note: WaveVR EventSystem is not affected even if the pointer is hidden.

Go to Show or hide the controller pointer (sample code) to learn how to show or hide the controller pointer.

Show or hide the controller pointer (sample code)

Follow the steps below to to show or hide the controller pointer.
  1. Add the following code to get the controller instances.
    private GameObject dominantController = null, nonDominantController = null;
    void OnEnable()
    {
        WaveVR_Utils.Event.Listen (WaveVR_Utils.Event.CONTROLLER_MODEL_LOADED, OnControllerLoaded);
    }
    
    void OnControllerLoaded(params object[] args)
    {
        WaveVR_Controller.EDeviceType _type = (WaveVR_Controller.EDeviceType)args [0];
        if (_type == WaveVR_Controller.EDeviceType.Dominant)
        {
            this.dominantController = (GameObject)args [1];
        }
        if (_type == WaveVR_Controller.EDeviceType.NonDominant)
        {
            this.nonDominantController = (GameObject)args [1];
        }
    }
    
    void OnDisable()
    {
        WaveVR_Utils.Event.Remove (WaveVR_Utils.Event.CONTROLLER_MODEL_LOADED, OnControllerLoaded);
    }
  2. Assuming there are 2 functions, ShowPointer and HidePointer, use the following code.
    public void ShowPointer()
    {
        WaveVR_ControllerPointer _cp = null;
        if (this.dominantController != null)
        {
            _cp = this.dominantController.GetComponentInChildren<WaveVR_ControllerPointer> ();
            if (_cp != null)
            {
                _cp.ShowPointer = true;
            }
        }
        if (this.nonDominantController != null)
        {
            _cp = this.nonDominantController.GetComponentInChildren<WaveVR_ControllerPointer> ();
            if (_cp != null)
            {
                _cp.ShowPointer = true;
            }
        }
    }
    
    public void HidePointer()
    {
        WaveVR_ControllerPointer _cp = null;
        if (this.dominantController != null)
        {
            _cp = this.dominantController.GetComponentInChildren<WaveVR_ControllerPointer> ();
            if (_cp != null)
            {
                _cp.ShowPointer = false;
            }
        }
        if (this.nonDominantController != null)
        {
            _cp = this.nonDominantController.GetComponentInChildren<WaveVR_ControllerPointer> ();
            if (_cp != null)
            {
                _cp.ShowPointer = false;
            }
        }
    }
Submit
Thank you! Your feedback helps others to see the most helpful information.