MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.31k stars 21.48k forks source link

Adding Spatial Anchors SDK to dependencies in manifest induces namespace errors (Unity MRTK) #69824

Closed dylan-fox closed 3 years ago

dylan-fox commented 3 years ago

I followed the instructions on this page for adding the Azure MR Services to scoped registries and Azure Spatial Anchors SDK to dependencies (windows only, not android or iOS), but this immediately induces a number of namespace issues in my project. For example:

("Library\PackageCache\com.unity.xr.windowsmr@2.5.2\Runtime\ReferencePoint\WindowsMRReferencePointSubsystem.cs(100,28): error CS0246: The type or namespace name 'IProvider' could not be found (are you missing a using directive or an assembly reference?)")

Also, it seems to cause conflicts with Unity's XR Plug-in Management system. It keeps unchecking my "Windows Mixed Reality" plug-in provider box. When I try to re-check it, I get these three errors:

1 Instance of UnityEngine.XR.WindowsMR.WindowsMRLoader couldn't be created. The the script class needs to derive from ScriptableObject.

2 We were unable to create an instance of the requested type UnityEngine.XR.WindowsMR.WindowsMRLoader. Please make sure that all packages are updated to support this version of XR Plug-In Management. See the Unity documentation for XR Plug-In Management for information on resolving this issue.

3 XR Plug-in Management error. Failure reason: Unable to assign com.unity.xr.windowsmr for build target WSA.. Check if there are any other errors in the console and make sure they are corrected before trying again.

I also tried installing the Windows Mixed Reality v4.2.3 package via Package Manager and got this error: Some scripts have compilation errors which may prevent obsolete API usages to get updated. Obsolete API updating will continue automatically after these errors get fixed.

I tried uninstalling the Azure stuff, reinstalling the Windows MR Plugin, and then reinstalling the Azure stuff, but it broke again.

I'm in Unity 2019.4.18f1, using MRTK 2.5.3. Installing and removing any number of packages didn't help, nor did cleaning my cache. Help please!


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

SatishBoddu-MSFT commented 3 years ago

@dylan-fox I have assigned the issue to the content author for further review and update the doc as appropriate.

msftradford commented 3 years ago

Hey @dylan-fox, thanks for reaching out! We'll be happy to help get to the bottom of this. I've filed an internal issue (#31582717) to help keep track of our investigation. Have you been able to run the Unity ASA Sample app? Have you checked the prerequisite settings for creating a Unity HoloLens app with ASA? Are you able to share a minimal reproduction of the issue with us? Thanks.

dylan-fox commented 3 years ago

Hi @mstradford, thanks for looking into it. I was able to build and deploy the Quickstart app via Unity to my HoloLens 2 and it worked fine, including setting up Azure, getting my anchor's key, etc.

The issue specifically came up when I tried to add the Windows spatial anchors dependencies to my existing project that I had configured using MRTK and Unity's XR plug-in management, at which point it behaved as described in my initial comment; let me know what additional information would be helpful in creating a reproduction.

I should note that Sahil Mayenkar on the HoloDevelopers Slack posted this, which I have yet to confirm:

Azure Spatial Anchors only supports the legacy XR pipeline at this time, not the new XR Plugin Framework.

#201 Suggestion : Update to Windows XR Plugin for next version

#212 Hololens2 Unity Windows XR Plugin support

#219 Spatial Anchors on Unity 2020.1.6

The last link shows the specific roadblock that's preventing support for the new XR plugin system at this time. Not sure if Azure Spatial Anchors will ever support the new WMR plugin via XR plugin management, however, I know they are working on supporting the new XR plugin system via the OpenXR platform.

From the documentation: "Azure Spatial Anchors support is coming in a future release."

The following conversation also suggests that support will be available soon.

Hope this helps! I would love to be able to use Spatial Anchors without having to backtrack to Unity's old "VR Supported" system in Player Settings.

msftradford commented 3 years ago

Thanks for all of the info @dylan-fox. I can confirm that ASA only supports the legacy XR pipeline at this time. You should still be able to use MRTK and ASA, but unfortunately you will not be able to use the Unity XR plugin framework. As you've noted above, we are actively working to prepare ASA for Unity 2020 and the new XR framework.

dylan-fox commented 3 years ago

OK, thanks for the confirmation. You might want to include a note to that effect on the documentation here to clarify for future users. Looking forward to the new Unity 2020 pipeline!

msftradford commented 3 years ago

Thanks for the suggestion @dylan-fox, I just merged a PR providing that guidance.

please-close