예제 #1
0
 private static void CheckAndRequestPrivilege(MLPrivileges.Id privilegeId)
 {
     if (MLPrivileges.CheckPrivilege(privilegeId) == MLResult.Code.PrivilegeNotGranted)
     {
         Debug.LogError(MLResult.Code.PrivilegeNotGranted + ": " + privilegeId);
         MLPrivileges.RequestPrivilege(privilegeId);
     }
 }
예제 #2
0
        /// <summary>
        /// Used to check if your privilege has already been granted.
        /// </summary>
        /// <param name="privilege">The privilege to check for.</param>
        public static MLResult CheckPrivilege(MLPrivileges.Id privilege)
        {
            #if PLATFORM_LUMIN
            _result = MLPrivileges.CheckPrivilege(privilege);

            if (_result.Result != MLResult.Code.PrivilegeGranted && _result.Result != MLResult.Code.PrivilegeNotGranted)
            {
                Debug.LogErrorFormat("Error: MLPrivilegesStarterKit.CheckPrivilege failed for the privilege {0}. Reason: {1}", privilege, _result);
            }
            #endif

            return(_result);
        }
        /// <summary>
        /// Used to check if your privilege has already been granted.
        /// </summary>
        /// <param name="privilege">The privilege to check for.</param>
        public static MLResult CheckPrivilege(MLPrivileges.Id privilege)
        {
            #if PLATFORM_LUMIN
            if (MLPrivileges.IsStarted)
            {
                _result = MLPrivileges.CheckPrivilege(privilege);

                if (_result.Result != MLResult.Code.PrivilegeGranted && _result.Result != MLResult.Code.PrivilegeNotGranted)
                {
                    Debug.LogErrorFormat("Error: MLPrivilegesStarterKit.CheckPrivilege failed for the privilege {0}. Reason: {1}", privilege, _result);
                }
            }

            else
            {
                Debug.LogError("Error: MLPrivilegesStarterKit.CheckPrivilege failed because MLPrivileges was not started.");
                _result = MLResult.Create(MLResult.Code.UnspecifiedFailure, "MLPrivileges was not started");
            }
            #endif

            return(_result);
        }
예제 #4
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);
        }