rhylvin2019
rhylvin2019

Reputation: 63

Getting started with Azure Spatial Anchors: CreateAzureAnchor() crash or taking a long time to load

I have been following this tutorial: https://learn.microsoft.com/en-us/windows/mixed-reality/develop/unity/tutorials/mr-learning-asa-02

there were some necessary configurations and steps not included in the tutorial like: it needed an ARCameraManager error log it needed an ARSession error log

which I configured as I keep getting errors and fixing it along the way

and was able to deploy, test and follow the in-device tutorial:

  1. Move the cube to a different location

  2. Start Azure Session

  3. Create Azure Anchor (creates an anchor at the location of the cube). ......

but I got stuck in #3

when I tap for create Azure button, it just crash but when I check the Debug version, it didn't actually crash cause there were no actual errors, I think it just keeps loading and/or working on the current main thread because everything disappeared when I tap the create Azure Button.

I check the codes of its corresponding function and this is it:

enter image description here

as you may notice it has an error, this is the actual script from the package I download, but all I had to do to fix this is add ".Result" after ".GetPointer()"

I divided the script and added logs so I can see which part is the problem:

enter image description here

the very last to log is: "tastInpt" which means getting the result is the problem.

is this fixable? can anyone help me get through this?

Upvotes: 0

Views: 860

Answers (3)

rhylvin2019
rhylvin2019

Reputation: 63

Was able to fix this on my own by using this: a github repository of Azure samples. I actually don't know why this worked but the samples from Microsoft didn't. but here you go:

https://github.com/Azure/azure-spatial-anchors-samples

Upvotes: 1

rhylvin2019
rhylvin2019

Reputation: 63

I just realize my fix for that error:

                gameObject.GetComponent<UnityEngine.XR.WSA.WorldAnchor>().SetNativeSpatialAnchorPtr(currentCloudAnchor.LocalAnchor);

is just to comment it out since I thought this won't be necessary, because I was yet to start development and as I understand (from reading the code) that this is just for loading the anchor not creating it, but I might be wrong. but anyway It's one of the things we must fix also in order to load. or create(if this does indeed help with the create anchor feature)

enter image description here

again this script is from:

MRTK.HoloLens2.Unity.Tutorials.Assets.AzureSpatialAnchors.2.5.3.unitypackage

Upvotes: 0

Will Yeo - MSFT
Will Yeo - MSFT

Reputation: 241

Could you provide little more info about your environment? For example, Unity version, Azure Spatial Anchors (ASA) SDK version and OS version of your HoloLens 2 device.

Are you using the matching ASA SDK for your Unity? In the tutorial you mentioned above has a link to this page: https://learn.microsoft.com/en-us/azure/spatial-anchors/how-tos/setup-unity-project?tabs=unity-package-web-ui

Some common mistakes includes the version mismatch - Unity 2019 requires ASA SDK 2.7 or above and below 2.9, and Unity 2020 requires min version of 2.9.

Upvotes: 1

Related Questions