Mixedrealitytoolkit-unity: vNext Task: Expose the currently enabled and loaded XR SDK

Created on 5 Sep 2018  路  16Comments  路  Source: microsoft/MixedRealityToolkit-Unity

Overview

At the MR Dev Summit (08/2018) there was a discussion about the desire/need to customize an application's UX based on the platform on which it is running. To enable developers to perform these customizations, we should provide a mechanism for them to ask the MixedRealityManager to return the platform.

I suggest we return values based on the VR SDK setting in Unity. Ex:

  • Windows Mixed Reality
  • OpenVR
  • ARKit
  • ARCore
  • etc

Requirements

Need an enum that defines the platform and an API to ask for it,

Acceptance Criteria

  • [ ] Can ask for the platform
  • [ ] Tested on Windows Mixed Reality and OpenVR
Feature Request

Most helpful comment

PR submitted.
@wassx the correct way of accessing the profile should be

MixedRealityManager.ActiveProfile.CameraProfile.IsOpaque

Which should be addressed on that PR, correctly getting it from the profile and not a static property

All 16 comments

Pretty sure this is already built into Unity, but I could be wrong.

Yeah, most of those only enumerate what is defined in the project and not really what is actively connected.
But I suppose it will be easy enough for each device manager to set an enum for the running platform, on top of what Unity provides.

Related to #2257

Additionally it would be nice if the device info contains if it's opaque, and if opaque, has the height of the head above measured ground.

We already support that:

MixedRealityManager.Instance.ActiveProfile.CameraProfile.IsOpaque which is cross platform.

When using like this, I get a "Cannot access static property 'IsOpaque' in non-static context".
So MixedRealityCameraProfile.IsOpaque is the way how to use?

You've got to get it from the mixed reality manager's active profile.

Hm, maybe I miss something, but in the MixedRealityManager:157 it is accessed in a static context?

The Mixed Reality Manager is the one and only singleton in the entire vNext generation of the Mixed Reality Toolkit.
Accessing it anywhere in code simply involves:

MixedRealityManager.Instance

From there, you can interrogate the Current runtime configuration of the Manager, including all the child component configuration from:

MixedRealityManager.Instance.ActiveProfile

There are also some other static properties of the MRManager, to enable quick discovery of certain services and whether the MRManager has been configured.

Behind all this, is also the service discovery framework, used to Get / Add or manage any service / manager / components currently registered with the manager through

MixedRealityManager.Instance.Getmanager<ManagerInterface>
// or
MixedRealityManager.Instance.Getmanager(ManagerType)

Hope that helps clear that up.

Ok, but that would include adding a non-static accessor like:
public bool IsOpaqueDisplay() { return IsOpaque; // the static }
?
I think I'm stumbling over my own feet...

Sorry, the IsOpaque property on the MixedRealityCameraProfile is a static, so you can simply access it with

If(Core.Definitions.MixedRealityCameraProfile.IsOpaque)

Ah! Maybe we shouldn't have that be static and part of our interface definition. 馃 Sorry that was on me, when I ported it.

PR submitted.
@wassx the correct way of accessing the profile should be

MixedRealityManager.ActiveProfile.CameraProfile.IsOpaque

Which should be addressed on that PR, correctly getting it from the profile and not a static property

@SimonDarksideJ Thank you!

Platform implies what the project is building for (i.e. Android, iOS, Windows Standalone, UWP, etc.) Updating title to reflect VR SDK target.

Was this page helpful?
0 / 5 - 0 ratings