示例#1
0
 /// <summary>
 /// If the Privileges API is running, stop it.
 /// </summary>
 void OnDestroy()
 {
     if (MLPrivileges.IsStarted)
     {
         MLPrivileges.Stop();
     }
 }
 /// <summary>
 /// Stops MLPrivileges.
 /// </summary>
 public static void Stop()
 {
     #if PLATFORM_LUMIN
     if (MLPrivileges.IsStarted)
     {
         MLPrivileges.Stop();
     }
     #endif
 }
        /// <summary>
        /// Shuts down the systems started in Start
        /// </summary>
        void OnDestroy()
        {
            if (MLPersistentCoordinateFrames.IsStarted)
            {
                MLPersistentCoordinateFrames.Stop();
            }
            if (MLPersistentStore.IsStarted)
            {
                MLPersistentStore.Stop();
            }

            MLPrivileges.Stop();
        }
示例#4
0
        /// <summary>
        /// Unregister callbacks and stop input API.
        /// </summary>
        void OnDestroy()
        {
            if (MLInput.IsStarted)
            {
                MLInput.OnControllerButtonDown -= HandleOnButtonDown;
                MLInput.Stop();
            }

            if (_currentPrivilegeState != PrivilegeState.Off)
            {
                MLPrivileges.Stop();
            }
        }
        /// <summary>
        /// Shuts down the started systems.
        /// </summary>
        void OnDestroy()
        {
#if !UNITY_EDITOR
            if (MLInput.IsStarted)
            {
                MLInput.OnControllerButtonDown -= HandleButtonDown;
                MLInput.Stop();
            }
#endif
            if (MLPersistentCoordinateFrames.IsStarted)
            {
                MLPersistentCoordinateFrames.Stop();
            }
            if (MLPersistentStore.IsStarted)
            {
                MLPersistentStore.Stop();
            }

            MLPrivileges.Stop();
        }
        /// <summary>
        /// Stop the camera, unregister callbacks, and stop input and privileges APIs.
        /// </summary>
        void OnDisable()
        {
            if (MLInput.IsStarted)
            {
                MLInput.OnControllerButtonDown -= OnButtonDown;
                MLInput.Stop();
            }

            if (_isCameraConnected)
            {
                DisableMLCamera();
            }

            if (_currentPrivilegeState != PrivilegeState.Off)
            {
                MLPrivileges.Stop();

                _currentPrivilegeState = PrivilegeState.Off;
                _privilegesGranted.Clear();
            }
        }
示例#7
0
        /// <summary>
        /// Stop the camera, unregister callbacks, and stop input and privileges APIs.
        /// </summary>
        void OnDisable()
        {
            if (MLInput.IsStarted)
            {
                MLInput.OnControllerButtonDown -= OnButtonDown;
                MLInput.Stop();
            }

            if (_isCameraConnected)
            {
                MLCamera.OnRawImageAvailable -= OnCaptureRawImageComplete;
                _isCapturing = false;
                DisableMLCamera();
            }

            if (_currentPrivilegeState != PrivilegeState.Off)
            {
                MLPrivileges.Stop();

                _currentPrivilegeState = PrivilegeState.Off;
                _privilegesGranted.Clear();
            }
        }
示例#8
0
        /// <summary>
        /// Assure that if the 'WorldReconstruction' privilege is missing, then it is logged for all users
        /// </summary>
        private IEnumerator LogWorldReconstructionMissingPrivilege()
        {
            yield return(new WaitUntil(() => MagicLeapDevice.IsReady()));

            MLResult result = MLPrivileges.Start();

            if (result.IsOk)
            {
                result = MLPrivileges.CheckPrivilege(MLPrivilegeId.WorldReconstruction);
                if (result.Code != MLResultCode.PrivilegeGranted)
                {
                    Debug.LogErrorFormat("Error: Unable to create Mesh Subsystem due to missing 'WorldReconstruction' privilege. Please add to manifest. Disabling script.");
                    enabled = false;
                }
                MLPrivileges.Stop();
            }

            else
            {
                Debug.LogErrorFormat("Error: MeshingExample failed starting MLPrivileges. Reason: {0}", result);
            }

            yield return(null);
        }