แก้ไข

แชร์ผ่าน


Extension services — MRTK2

Extension services are components that extend the functionality of Mixed Reality Toolkit. These services may be provided by MRTK or by other parties.

Creating an extension service

The most efficient way to create an extension service is to use the extension service creation wizard. To start the extension service creation wizard, select Mixed Reality Toolkit > Utilities > Create Extension Service.

Extension service creation wizard

The wizard automates the creation of the service components and ensures the proper interface inheritance.

Components created by the extension service creation wizard

Note

In MRTK version 2.0.0, there is an issue in the extension service wizard where the service inspector and service profile are required to be generated. Please see issue 5654 for more information.

When the wizard completes, the service functionality can be implemented.

Registering an extension service

To be accessible by an application, the new extension service needs to be registered with Mixed Reality Toolkit.

The extension service creation wizard can be used to register the service.

Extension service creation wizard registration

The service can also be manually registered using the Mixed Reality Toolkit configuration inspector.

Manual extension service registration

If the extension service uses a profile, please ensure that it is specified in the inspector.

Configured extension service

The component name and priority can also be adjusted.

Accessing an extension service

Extension services are accessed, in code, using the MixedRealityServiceRegistry as shown in the example below.

INewService service = null;
if (MixedRealityServiceRegistry.TryGetService<INewService>(out service))
{
    // Succeeded in getting the service,  perform any desired tasks.
}

See also