We've moved!

Starting from MRTK 2.6, we are publishing both conceptual docs and API references on docs.microsoft.com. For conceptual docs, please visit our new landing page. For API references, please visit the MRTK-Unity section of the dot net API explorer. Existing content will remain here but will not be updated further.

    Show / Hide Table of Contents

    Class MixedRealityToolkit

    This class is responsible for coordinating the operation of the Mixed Reality Toolkit. It is the only Singleton in the entire project. It provides a service registry for all active services that are used within a project as well as providing the active configuration profile for the project. The Profile can be swapped out at any time to meet the needs of your project.

    Inheritance
    Object
    MixedRealityToolkit
    Implements
    IMixedRealityServiceRegistrar
    Namespace: Microsoft.MixedReality.Toolkit
    Assembly: cs.temp.dll.dll
    Syntax
    public class MixedRealityToolkit : MonoBehaviour, IMixedRealityServiceRegistrar

    Properties

    ActiveProfile

    The public property of the Active Profile, ensuring events are raised on the change of the configuration

    Declaration
    public MixedRealityToolkitConfigurationProfile ActiveProfile { get; set; }
    Property Value
    Type Description
    MixedRealityToolkitConfigurationProfile

    ActiveSystems

    Current active systems registered with the MixedRealityToolkit.

    Declaration
    public IReadOnlyDictionary<Type, IMixedRealityService> ActiveSystems { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<Type, IMixedRealityService>
    Remarks

    Systems can only be registered once by Type

    BoundarySystem

    The current Boundary System registered with the Mixed Reality Toolkit.

    Declaration
    public static IMixedRealityBoundarySystem BoundarySystem { get; }
    Property Value
    Type Description
    IMixedRealityBoundarySystem

    CameraSystem

    The current Camera System registered with the Mixed Reality Toolkit.

    Declaration
    public static IMixedRealityCameraSystem CameraSystem { get; }
    Property Value
    Type Description
    IMixedRealityCameraSystem

    DiagnosticsSystem

    The current Diagnostics System registered with the Mixed Reality Toolkit.

    Declaration
    public static IMixedRealityDiagnosticsSystem DiagnosticsSystem { get; }
    Property Value
    Type Description
    IMixedRealityDiagnosticsSystem

    HasActiveProfile

    Checks if there is a valid instance of the MixedRealityToolkit, then checks if there is there a valid Active Profile.

    Declaration
    public bool HasActiveProfile { get; }
    Property Value
    Type Description
    Boolean

    InputSystem

    The current Input System registered with the Mixed Reality Toolkit.

    Declaration
    public static IMixedRealityInputSystem InputSystem { get; }
    Property Value
    Type Description
    IMixedRealityInputSystem

    Instance

    Returns the Singleton instance of the classes type.

    Declaration
    public static MixedRealityToolkit Instance { get; }
    Property Value
    Type Description
    MixedRealityToolkit

    IsActiveInstance

    Returns true if this is the active instance.

    Declaration
    public bool IsActiveInstance { get; }
    Property Value
    Type Description
    Boolean

    IsInitialized

    Returns whether the instance has been initialized or not.

    Declaration
    public static bool IsInitialized { get; }
    Property Value
    Type Description
    Boolean

    IsSceneSystemEnabled

    Returns true if the MixedRealityToolkit exists and has an active profile that has Scene system enabled.

    Declaration
    public static bool IsSceneSystemEnabled { get; }
    Property Value
    Type Description
    Boolean

    IsTeleportSystemEnabled

    Returns true if the MixedRealityToolkit exists and has an active profile that has Teleport system enabled.

    Declaration
    public static bool IsTeleportSystemEnabled { get; }
    Property Value
    Type Description
    Boolean

    RegisteredMixedRealityServices

    Local service registry for the Mixed Reality Toolkit, to allow runtime use of the IMixedRealityService.

    Declaration
    public IReadOnlyList<Tuple<Type, IMixedRealityService>> RegisteredMixedRealityServices { get; }
    Property Value
    Type Description
    IReadOnlyList<Tuple<Type, IMixedRealityService>>

    SceneSystem

    The current Scene System registered with the Mixed Reality Toolkit.

    Declaration
    public static IMixedRealitySceneSystem SceneSystem { get; }
    Property Value
    Type Description
    IMixedRealitySceneSystem

    SpatialAwarenessSystem

    The current Spatial Awareness System registered with the Mixed Reality Toolkit.

    Declaration
    public static IMixedRealitySpatialAwarenessSystem SpatialAwarenessSystem { get; }
    Property Value
    Type Description
    IMixedRealitySpatialAwarenessSystem

    TeleportSystem

    The current Teleport System registered with the Mixed Reality Toolkit.

    Declaration
    public static IMixedRealityTeleportSystem TeleportSystem { get; }
    Property Value
    Type Description
    IMixedRealityTeleportSystem

    Methods

    AssertIsInitialized()

    Expose an assertion whether the MixedRealityToolkit class is initialized.

    Declaration
    public static void AssertIsInitialized()

    ConfirmInitialized()

    Static function to determine if the MixedRealityToolkit class has been initialized or not.

    Declaration
    public static bool ConfirmInitialized()
    Returns
    Type Description
    Boolean

    DisableAllServicesByType(Type)

    Disable all services in the Mixed Reality Toolkit active service registry for a given type

    Declaration
    public void DisableAllServicesByType(Type interfaceType)
    Parameters
    Type Name Description
    Type interfaceType

    The interface type for the system to be removed. E.G. InputSystem, BoundarySystem

    DisableAllServicesByTypeAndName(Type, String)

    Disable all services in the Mixed Reality Toolkit active service registry for a given type and name

    Declaration
    public void DisableAllServicesByTypeAndName(Type interfaceType, string serviceName)
    Parameters
    Type Name Description
    Type interfaceType

    The interface type for the system to be disabled. E.G. InputSystem, BoundarySystem

    String serviceName

    Name of the specific service

    EnableAllServicesByType(Type)

    Enable all services in the Mixed Reality Toolkit active service registry for a given type

    Declaration
    public void EnableAllServicesByType(Type interfaceType)
    Parameters
    Type Name Description
    Type interfaceType

    The interface type for the system to be enabled. E.G. InputSystem, BoundarySystem

    EnableAllServicesByTypeAndName(Type, String)

    Enable all services in the Mixed Reality Toolkit active service registry for a given type and name

    Declaration
    public void EnableAllServicesByTypeAndName(Type interfaceType, string serviceName)
    Parameters
    Type Name Description
    Type interfaceType

    The interface type for the system to be enabled. E.G. InputSystem, BoundarySystem

    String serviceName

    Name of the specific service

    GetService<T>(String, Boolean)

    Gets the instance of the registered service.

    Declaration
    public T GetService<T>(string name = null, bool showLogs = true)
        where T : IMixedRealityService
    Parameters
    Type Name Description
    String name

    The name of the service.

    Boolean showLogs

    Indicates whether or not diagnostic logging should be performed in case of an error

    Returns
    Type Description
    T

    The registered service instance as the requested type.

    Type Parameters
    Name Description
    T

    The interface type of the service (ex: IMixedRealityBoundarySystem).

    GetServices<T>(String)

    Gets the collection of the registered service instances matching the requested type.

    Declaration
    public IReadOnlyList<T> GetServices<T>(string name = null)
        where T : IMixedRealityService
    Parameters
    Type Name Description
    String name

    Friendly name of the service.

    Returns
    Type Description
    IReadOnlyList<T>

    Read-only collection of the service instances, as the requested type.

    Type Parameters
    Name Description
    T

    The interface type of the service (ex: IMixedRealityBoundarySystem).

    IsServiceRegistered<T>(String)

    Checks to see if a service of the specified type has been registered.

    Declaration
    public bool IsServiceRegistered<T>(string name = null)
        where T : IMixedRealityService
    Parameters
    Type Name Description
    String name

    The name of the service.

    Returns
    Type Description
    Boolean

    True if the service is registered, false otherwise.

    Type Parameters
    Name Description
    T

    The interface type of the service (ex: IMixedRealityBoundarySystem).

    IsSystemRegistered<T>()

    Generic function used to interrogate the Mixed Reality Toolkit active system registry for the existence of a core system.

    Declaration
    public bool IsSystemRegistered<T>()
        where T : IMixedRealityService
    Returns
    Type Description
    Boolean

    True, there is a system registered with the selected interface, False, no system found for that interface

    Type Parameters
    Name Description
    T

    The interface type for the system to be retrieved. E.G. InputSystem, BoundarySystem.

    Remarks

    Note: type should be the Interface of the system to be retrieved and not the concrete class itself.

    RegisterService<T>(T)

    Declaration
    public bool RegisterService<T>(T serviceInstance)
        where T : IMixedRealityService
    Parameters
    Type Name Description
    T serviceInstance
    Returns
    Type Description
    Boolean
    Type Parameters
    Name Description
    T

    RegisterService<T>(Type, SupportedPlatforms, Object[])

    Registers a service of the specified type.

    Declaration
    public bool RegisterService<T>(Type concreteType, SupportedPlatforms supportedPlatforms = null, params object[] args)
        where T : IMixedRealityService
    Parameters
    Type Name Description
    Type concreteType

    The concrete type to instantiate.

    SupportedPlatforms supportedPlatforms

    The platform(s) on which the service is supported.

    Object[] args

    Optional arguments used when instantiating the concrete type.

    Returns
    Type Description
    Boolean

    True if the service was successfully registered, false otherwise.

    Type Parameters
    Name Description
    T

    The interface type of the service to be registered (ex: IMixedRealityBoundarySystem).

    ResetConfiguration(MixedRealityToolkitConfigurationProfile)

    When a configuration Profile is replaced with a new configuration, force all services to reset and read the new values

    Declaration
    public void ResetConfiguration(MixedRealityToolkitConfigurationProfile profile)
    Parameters
    Type Name Description
    MixedRealityToolkitConfigurationProfile profile

    SetActiveInstance(MixedRealityToolkit)

    Declaration
    public static void SetActiveInstance(MixedRealityToolkit toolkitInstance)
    Parameters
    Type Name Description
    MixedRealityToolkit toolkitInstance

    SetInstanceInactive(MixedRealityToolkit)

    Declaration
    public static void SetInstanceInactive(MixedRealityToolkit toolkitInstance)
    Parameters
    Type Name Description
    MixedRealityToolkit toolkitInstance

    UnregisterService<T>(T)

    Declaration
    public bool UnregisterService<T>(T serviceInstance)
        where T : IMixedRealityService
    Parameters
    Type Name Description
    T serviceInstance
    Returns
    Type Description
    Boolean
    Type Parameters
    Name Description
    T

    UnregisterService<T>(String)

    Unregisters a service of the specified type.

    Declaration
    public bool UnregisterService<T>(string name = null)
        where T : IMixedRealityService
    Parameters
    Type Name Description
    String name

    The name of the service to unregister.

    Returns
    Type Description
    Boolean

    True if the service was successfully unregistered, false otherwise.

    Type Parameters
    Name Description
    T

    The interface type of the service to be unregistered (ex: IMixedRealityBoundarySystem).

    Remarks

    If the name argument is not specified, the first instance will be unregistered

    Implements

    IMixedRealityServiceRegistrar
    Back to top Generated by DocFX