示例#1
0
        /// <summary>
        /// Remove services from the Mixed Reality Toolkit active service registry for a given type and name
        /// Name is only supported for Mixed Reality runtime components
        /// </summary>
        /// <param name="type">The interface type for the system to be removed.  E.G. InputSystem, BoundarySystem</param>
        /// <param name="serviceName">The name of the service to be removed. (Only for runtime components) </param>
        public void UnregisterService(Type type, string serviceName)
        {
            if (ActiveProfile == null)
            {
                Debug.LogError($"Unable to remove {serviceName} Manager as the Mixed Reality Manager has no Active Profile.");
                return;
            }

            if (type == null)
            {
                Debug.LogError("Unable to remove null manager type.");
                return;
            }

            if (string.IsNullOrEmpty(serviceName))
            {
                Debug.LogError("Unable to remove manager by name without the name being specified.");
                return;
            }

            if (IsCoreSystem(type))
            {
                ActiveProfile.ActiveServices.Remove(type);
            }
            else
            {
                IMixedRealityService service;

                if (GetService(type, serviceName, out service))
                {
                    MixedRealityComponents.Remove(new Tuple <Type, IMixedRealityExtensionService>(type, (IMixedRealityExtensionService)service));
                }
            }
        }
示例#2
0
        /// <summary>
        /// Remove all services from the Mixed Reality Toolkit active service registry for a given type
        /// </summary>
        /// <param name="type">The interface type for the system to be removed.  E.G. InputSystem, BoundarySystem</param>
        public void UnregisterService(Type type)
        {
            if (ActiveProfile == null)
            {
                Debug.LogError($"Unable to remove {nameof(type)} Manager as the Mixed Reality Manager has no Active Profile.");
                return;
            }

            if (type == null)
            {
                Debug.LogError("Unable to remove null manager type.");
                return;
            }

            if (IsCoreSystem(type))
            {
                ActiveProfile.ActiveServices.Remove(type);
            }
            else
            {
                IMixedRealityService service;
                GetService(type, out service);
                if (service != null)
                {
                    MixedRealityComponents.Remove(new Tuple <Type, IMixedRealityExtensionService>(type, (IMixedRealityExtensionService)service));
                }
            }
        }