Azure / azure-spatial-anchors-samples

Azure Spatial Anchors sample code
Other
293 stars 138 forks source link

AR Foundation 5.0+ support #389

Closed SimonDarksideJ closed 1 year ago

SimonDarksideJ commented 1 year ago

Description

Currently, Azure Spatial Anchors is only supported under ARFoundation 4 which is being replaced with V5 in Unity 2022.

To continue operation in Unity 2022, Azure SPatial Anchors needs to be updated to support ARFoundation 5+

Steps to reproduce the issue

If the issue occurs in one of the ASA sample apps, please detail the steps required to reproduce it. Otherwise, provide details on how to reproduce it in your custom app.

  1. Create a new Unity 2022 project
  2. Import Azure Spatial Anchors
  3. See errors.....

Expected behavior

Azure Spatial Anchors for iOS/Android and UWP should continue to function with ARFoundation 5

darax commented 1 year ago

Hi @SimonDarksideJ, To get compiling with ARFoundation5 we need to add a reference to Unity.XR.CoreUtils to the ASA Asmdef. Until we have a release that does this, there are a few ways you can do this:

In either case, there are two .asmdef files to modify, Core\Editor and Core\Runtime. My runtime asmdef looks like: { "name": "AzureSpatialAnchors.SDK.Core.Runtime", "references": [ "Unity.XR.ARSubsystems", "Unity.XR.ARFoundation", "Unity.XR.WindowsMixedReality", "Microsoft.MixedReality.OpenXR", "AzureSpatialAnchors.SDK.iOS.Runtime", "AzureSpatialAnchors.SDK.Windows.Runtime", "AzureSpatialAnchors.SDK.Android.Runtime", "Unity.XR.CoreUtils" ], "includePlatforms": [ "Android", "Editor", "iOS", "WSA" ], "excludePlatforms": [], "allowUnsafeCode": false, "overrideReferences": false, "precompiledReferences": [], "autoReferenced": true, "defineConstraints": [], "versionDefines": [ { "name": "com.microsoft.mixedreality.openxr", "expression": "0.0.1", "define": "ASA_UNITY_USE_OPENXR" } ] }

yishaiSilver commented 1 year ago

I'm getting: DllNotFoundException: azurespatialanchorsndk assembly. Any advice?

darax commented 1 year ago

@yishaiSilver not sure how that is related.
ARFoundation 5.0 should now work as of 2.14.1

mschult2 commented 1 year ago

@yishaiSilver not sure how that is related. ARFoundation 5.0 should now work as of 2.14.1

I've verified that SpatialAnchors 2.14.1 works with ARFoundation 5.0.5. Good stuff.

Note that if you're using ARFoundation 5 (5.0.5), you may have to upgrade your ARSubsystems package to 5.0.2, which is empty and deprecated. This satisfies SpatialAnchors' dependency on ARSubsystems, and also leaves ARFoundation 5 conflict-free. This is what I did.