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

            if (eventSystem == null)
            {
                PrintDebugLog("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> ();

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

        initInteractionModeAndGazeTriggerType();

        if (!this.EnableInputModule)
        {
            disableAllInputModules();
        }
    }
    private void CreateGazeInputModule()
    {
        if (gazeInputModule == null)
        {
            // Before initializing variables of input modules, disable EventSystem to prevent the OnEnable() of input modules being executed.
            eventSystem.SetActive(false);

            gazeInputModule = eventSystem.AddComponent <WaveVR_GazeInputModule> ();
            SetGazeInputModuleParameters();

            // Enable EventSystem after initializing input modules.
            eventSystem.SetActive(true);
        }
    }
    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();
        }
    }