microsoft / MixedReality-WorldLockingTools-Samples

Broader learning resources supporting World Locking Tools for Unity
Other
59 stars 19 forks source link

Missing Assembly Definition Reference to Microsoft.MixedReality.OpenXR? #76

Closed zantiu closed 3 years ago

zantiu commented 3 years ago

Shouldn't there also be a reference to Microsoft.MixedReality.OpenXR in following Assembly Definition? :

Assets/QRSpacePin/QRSpacePin.asmdef

fast-slow-still commented 3 years ago

@zantiu Can you describe the incorrect behavior you are seeing? Also, please include version info (WLT, Unity, XR Plugin), and basic configuration (especially WLT anchor management subsystem). Thanks!

zantiu commented 3 years ago

Well I got an error in our own project where we based parts of our code on a previous version of this sample. I just upgraded to OpenXR so I also needed to adjust the relevant code.

The error was that Microsoft.MixedReality.OpenXR could not be found. The error went away when adding it as a reference in the Assembly Definition.

Then comparing back to your sample you don't have it as a reference.

Version info: WLT: 1.5.4 Unity: 2020.3.8f1 Windows XR Plugin: 4.4.2 WLT Anchor Subsystem: XRSDK

Anyway the QR code scanning works again. Now I just need to review if the rest of WLT still works correctly.

fast-slow-still commented 3 years ago

Was the error at build or just in Unity when loading? Did it reference a specific script code trying to reference OpenXR?

Also, you say you are using Windows XR Plugin 4.4.2, how are you also using OpenXR?

fast-slow-still commented 3 years ago

I'm finding this very confusing, partly because the QRSpacePin.asmdef does have a reference to OpenXR. image

There was an API change going from Windows XR Plugin to MS OpenXR Plugin, and the code selectively includes the old way or the new way based on whether the OpenXR plugin is included using Version Defines.

image

That's why I would be very interested in details of a break involving the presence or absence of the OpenXR plugin, as the code should compile fine (but differently) either way.

zantiu commented 3 years ago

Was the error at build or just in Unity when loading? Did it reference a specific script code trying to reference OpenXR?

Also, you say you are using Windows XR Plugin 4.4.2, how are you also using OpenXR?

Yes I think Windows XR Plugin is irrelevant because the project settings have been changed to use OpenXR.

zantiu commented 3 years ago

Ok now I understand.

I did not try to run your sample, I just compared the code. And when I looked in Unity for the assembly references I saw this:

missing_assembly

The last assembly is greyed out, maybe because the package has not been imported yet in Unity. And that must be Microsoft.MixedReality.OpenXR.

So my issue was that OpenXR is present, but I didn't add it as an Assembly Definition Reference. Then I indeed have the same version define as you, detecting OpenXR, but Visual studio immediately gave an error on the line 'using Microsoft.MixedReality.OpenXR;' because the assembly reference was missing.

So this can be closed.