microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
5.99k stars 2.12k forks source link

OpenXR issue with Quest and MRTK 2.7.0 #9918

Closed ltwlf closed 3 years ago

ltwlf commented 3 years ago

Describe the bug

When you configure MRTK for OpenXR the Andriod/Quest build fails with compile issues, e.g. Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@01982308d54f-1621870973616\Providers\OpenXR\Scripts\MicrosoftArticulatedHand.cs(22,50): error CS0234: The type or namespace name 'OpenXR' does not exist in the namespace 'Microsoft.MixedReality' (are you missing an assembly reference?)

The cause of the issue is commit "Guard MROpenXR calls to Windows" 3c0298350db60e553464c6602c63ba512c11ff4f in PR #9897 by @keveleigh https://github.com/microsoft/MixedRealityToolkit-Unity/pull/9897/commits/3c0298350db60e553464c6602c63ba512c11ff4f

if MSFT_OPENXR && (UNITY_STANDALONE_WIN || UNITY_WSA)

In combination with the OpenXR flag MSFT_OPENXR for platform Android in MRTK.OpenXR.asmdef causes the above-described compile errors.

How to use MRTK with OpenXR Android? The largest advantage of OpenXR is cross-platform :)

Versions

Target platform (please complete the following information)

Additional context

image

keveleigh commented 3 years ago

I'm not able to repro this :/ @elbuhofantasma and I both tested building for Quest/Android, which is what led to #9897 (the && (UNITY_STANDALONE_WIN || UNITY_WSA) should cause those methods to not be compiled on Android, so it's odd that you're seeing them try to be built). Testing after that PR didn't have any issues.

I also just ran through what I think were your steps (but please correct me if I missed anything!)

  1. Create a new Unity project. Target Android
  2. Using the MR Feature Tool, install
    1. MRTK Standard Assets 2.7.0
    2. MRTK Foundation 2.7.0
    3. OpenXR 0.9.5
  3. Configure OpenXR for Quest image
  4. Add MRTK to the Unity scene
  5. Try to build the .apk

My build succeeded without those errors. Are you sure you're on the final 2.7.0? I'd say those exceptions are expected on all 2.7.0 previews but should no longer be present on the final release due to the PR you linked (#9897).

ltwlf commented 3 years ago

@keveleigh thanks for the fast reply. I checked the version and setup again and it should be okay. See here: https://www.youtube.com/watch?v=JoPYsKacF0Q

I tried it again with a new project and this time it is working. This is really weird :/ Don't know maybe something was cached. But great that it is working :) I close the issue and hope it was just a local-never-happens-again-sometime-unity-is-weird issue.

Thanks for helping.

provencher commented 3 years ago

@keveleigh one issue with this is that OpenXR on Quest doesn't support hand tracking, so it's worth keeping that in mind, and making it possible to build for Android without OpenXR, for now.

ltwlf commented 3 years ago

Android build works. I couldn't reproduce this issue. I also saw Quest OpenXR currently doesn't support hands, but in the MRTK controllers aren't working too. this should be possible #9919 I didn't check if the classic way with the Oculus OVR plugin is still working. As long Quest doesn't support hands this is important.