/// <summary/>
        protected override void Start()
        {
            base.Start();

            _headpose = Camera.main;
            if (_headpose == null)
            {
                Debug.LogError("Error: MLInputModule, no camera found tagged as MainCamera, disabling script.");
                enabled = false;
                return;
            }

            // Eye Tracking
            if (_pointerInput == PointerInputType.EyeTracking)
            {
                #if PLATFORM_LUMIN
                MLResult result = MLEyes.Start();
                if (!result.IsOk)
                {
                    Debug.LogErrorFormat("Error: MLInputModule failed starting MLEyes, disabling script. Reason: {0}", result);
                    enabled = false;
                    return;
                }
                #endif
            }

            #if PLATFORM_LUMIN
            // Controllers
            if (!MLInput.IsStarted)
            {
                MLInput.Configuration config = new MLInput.Configuration(true);
                MLResult result = MLInput.Start(config);
                if (!result.IsOk)
                {
                    Debug.LogErrorFormat("Error: MLInputModule failed starting MLInput, disabling script. Reason: {0}", result);
                    enabled = false;
                    return;
                }
            }
            #endif

            AddController(0);
            AddController(1);

            #if PLATFORM_LUMIN
            // Track connect / disconnect
            MLInput.OnControllerConnected    += HandleOnControllerConnected;
            MLInput.OnControllerDisconnected += HandleOnControllerDisconnected;

            _pointerInputDevice = new MLInputDevice();
            _pointerInputDevice.Initialize();
            _cachedTrackedPointerEventData = new MLInputDeviceEventData(eventSystem);
            #endif
        }
Beispiel #2
0
        /// <summary>
        /// Initializes component and start MLEyes.
        /// </summary>
        override protected void OnEnable()
        {
            base.OnEnable();

            MLResult result = MLEyes.Start();

            if (!result.IsOk)
            {
                Debug.LogErrorFormat("Error: WorldRaycastEyes failed starting MLEyes, disabling script. Reason: {0}", result);
                enabled = false;
                return;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Initializes component and start MLEyes.
        /// </summary>
        override protected void OnEnable()
        {
            base.OnEnable();

            MLResult result = MLEyes.Start();

            if (!result.IsOk)
            {
                Debug.LogError("Error WorldRaycastEyes starting MLEyes, disabling script.");
                enabled = false;
                return;
            }
        }
        /// <summary/>
        protected override void OnDestroy()
        {
            base.OnDestroy();

            if (MLInput.IsStarted)
            {
                MLInput.Stop();
            }

            MLInput.OnControllerConnected    -= HandleOnControllerConnected;
            MLInput.OnControllerDisconnected -= HandleOnControllerDisconnected;

            if (MLEyes.IsStarted)
            {
                MLEyes.Stop();
            }
        }
Beispiel #5
0
        /// <summary/>
        protected override void OnDestroy()
        {
            base.OnDestroy();

            #if PLATFORM_LUMIN
            if (MLInput.IsStarted)
            {
                MLInput.Stop();
            }

            MLInput.OnControllerConnected    -= HandleOnControllerConnected;
            MLInput.OnControllerDisconnected -= HandleOnControllerDisconnected;
            SceneManager.activeSceneChanged  -= ChangedActiveScene;

            if (MLEyes.IsStarted)
            {
                MLEyes.Stop();
            }
            #endif
        }
Beispiel #6
0
        /// <summary>
        /// Cleans up the component.
        /// </summary>
        override protected void OnDisable()
        {
            MLEyes.Stop();

            base.OnDisable();
        }
        /// <summary>
        /// Cleans up the component.
        /// </summary>
        override protected void OnDestroy()
        {
            MLEyes.Stop();

            base.OnDestroy();
        }