protected override void OnEnable()
    {
        base.OnEnable();

        EnableGaze = true;

        if (Head == null)
        {
            if (WaveVR_InputModuleManager.Instance != null)
            {
                Head = WaveVR_InputModuleManager.Instance.gameObject;
            }
            else
            {
                Head = WaveVR_Render.Instance.gameObject;
            }
        }

        if (gazePointer == null)
        {
            // Set gazePointer only when null, or it will got null when WaveVR_Reticle gameObject is SetActive(false).
            if (Head != null)
            {
                gazePointer = Head.GetComponentInChildren <WaveVR_Reticle> ();
            }
        }

        if (gazePointer != null)
        {
            if (this.UseWaveVRReticle)
            {
                PrintDebugLog("OnEnable() Head: " + Head.name + ", enable pointer, percent and counter canvas.");
                percentCanvas = gazePointer.transform.Find("PercentCanvas").gameObject;
                counterCanvas = gazePointer.transform.Find("CounterCanvas").gameObject;
                ActivateGazePointerCanvas(true);
            }
            else
            {
                ActivateGazePointerCanvas(false);
            }
        }

        sceneCanvases            = GameObject.FindObjectsOfType <Canvas> ();
        this.timerControlDefault = this.TimerControl;

        if (ringMesh == null)
        {
            if (this.Head != null)
            {
                ringMesh = this.Head.GetComponentInChildren <RingMeshDrawer> ();
                PrintDebugLog("OnEnable() found ringMesh " + (ringMesh != null ? ringMesh.gameObject.name : "null"));
            }
        }

        if (ringMesh != null)
        {
            ActivateMeshDrawer(!this.UseWaveVRReticle);
        }
    }
    private void ActivateGazePointer(bool active)
    {
        if (Gaze.Head == null)
        {
            gazePointer = null;
            gazeRing    = null;
            return;
        }
        if (gazePointer == null)
        {
            WaveVR_Reticle _wvr_reticle = Gaze.Head.GetComponentInChildren <WaveVR_Reticle> ();
            if (_wvr_reticle != null)
            {
                gazePointer = _wvr_reticle.gameObject;
            }
        }
        if (gazeRing == null)
        {
            RingMeshDrawer _ring_md = Gaze.Head.GetComponentInChildren <RingMeshDrawer> ();
            if (_ring_md != null)
            {
                gazeRing = _ring_md.gameObject;
            }
        }

        if (active)
        {
            if (Gaze.UseWaveVRReticle)
            {
                if (gazePointer != null)
                {
                    gazePointer.SetActive(true);
                }
            }
            else
            {
                if (gazeRing != null)
                {
                    gazeRing.SetActive(true);
                }
            }
        }
        else
        {
            if (gazePointer != null)
            {
                gazePointer.SetActive(false);
            }
            if (gazeRing != null)
            {
                gazeRing.SetActive(false);
            }
        }
    }
    protected override void OnEnable()
    {
        if (!mEnabled)
        {
            base.OnEnable();

            mEnableGaze = true;

            if (this.Head == null)
            {
                if (WaveVR_InputModuleManager.Instance != null)
                {
                    // Reticle Pointer & Ring are put under InputModuleManager
                    Head = WaveVR_InputModuleManager.Instance.gameObject;
                }
                else
                {
                    Head = WaveVR_Render.Instance.gameObject;
                }
            }

            if (gazePointer == null)
            {
                // Set gazePointer only when null, or it will got null when WaveVR_Reticle gameObject is SetActive(false).
                if (Head != null)
                {
                    gazePointer = Head.GetComponentInChildren <WaveVR_Reticle> ();
                }
            }

            if (gazePointer != null)
            {
                DEBUG("OnEnable() Head: " + Head.name + ", enable pointer, percent and counter canvas.");
                percentCanvas = gazePointer.transform.Find("PercentCanvas").gameObject;
                counterCanvas = gazePointer.transform.Find("CounterCanvas").gameObject;
            }

            this.timerControlDefault = this.TimerControl;

            if (ringMesh == null)
            {
                if (this.Head != null)
                {
                    ringMesh = this.Head.GetComponentInChildren <RingMeshDrawer> ();
                    DEBUG("OnEnable() found ringMesh " + (ringMesh != null ? ringMesh.gameObject.name : "null"));
                }
            }

            mEnabled = true;
        }
    }
    protected override void OnDisable()
    {
        PrintDebugLog("OnDisable()");
        base.OnDisable();

        EnableGaze = false;
        ActivateGazePointerCanvas(false);

        if (pointerData != null)
        {
            HandlePointerExitAndEnter(pointerData, null);
        }

        ActivateMeshDrawer(false);
        ringMesh = null;
    }
    protected override void OnDisable()
    {
        if (mEnabled)
        {
            DEBUG("OnDisable()");
            base.OnDisable();

            mEnableGaze = false;
            ActivateGazePointerCanvas(false);

            ActivateMeshDrawer(false);
            ringMesh = null;

            ExitAllObjects();

            mEnabled = false;
        }
    }
    void Start()
    {
        if (EventSystem.current == null)
        {
            EventSystem _es = FindObjectOfType <EventSystem> ();
            if (_es != null)
            {
                eventSystem = _es.gameObject;
                DEBUG("Start() find current EventSystem: " + eventSystem.name);
            }

            if (eventSystem == null)
            {
                DEBUG("Start() could not find EventSystem, create new one.");
                eventSystem = new GameObject("EventSystem", typeof(EventSystem));
            }
        }
        else
        {
            eventSystem = EventSystem.current.gameObject;
        }

        // Standalone Input Module
        StandaloneInputModule _sim = eventSystem.GetComponent <StandaloneInputModule> ();

        if (_sim != null)
        {
            _sim.enabled = false;
        }

        // Old GazeInputModule
        GazeInputModule _gim = eventSystem.GetComponent <GazeInputModule>();

        if (_gim != null)
        {
            Destroy(_gim);
        }

        // Gaze Input Module
        gazeInputModule = eventSystem.GetComponent <WaveVR_GazeInputModule> ();
        WaveVR_Reticle gazePointer = gameObject.GetComponentInChildren <WaveVR_Reticle> ();

        if (gazePointer != null)
        {
            gazePointerRenderer = gazePointer.gameObject.GetComponent <MeshRenderer> ();
            DEBUG("Start() found " + gazePointer.gameObject.name);
        }
        RingMeshDrawer ringMesh = gameObject.GetComponentInChildren <RingMeshDrawer> ();

        if (ringMesh != null)
        {
            gazeRingRenderer = ringMesh.gameObject.GetComponent <MeshRenderer> ();
            DEBUG("Start() found " + gazePointer.gameObject.name);
        }
        ActivateGazePointer(false);             // disable reticle

        // Controller Input Module
        controllerInputModule = eventSystem.GetComponent <WaveVR_ControllerInputModule> ();

        initInteractionModeAndGazeTriggerType();

        if (!this.EnableInputModule)
        {
            disableAllInputModules();
        }
    }