Azure spatial anchor is not created. Application on hololens 2 closes right away after I click on create anchor

Azzam, Israa 0 Reputation points
2024-01-01T15:50:59.59+00:00

I hope all is well!

I am working on developing a synchronized MR environment by allowing users to share spatial anchors across devices. I want to use Photon for real-time communication and synchronization between users and Azure Spatial Anchor to allow users to see and interact with the same virtual objects/information. Photon is working very well; I can connect up to 5 users to my photon room and track them. However, I am facing an issue with Azure Spatial Anchor (when creating the anchor).

For Azure Spatial Anchor:

I have been working on this tutorial: https://learn.microsoft.com/en-us/training/modules/azure-spatial-anchors-tutorials/3-exercise-get-started-with-azure-spatial-anchors

I followed the tutorial step by step and built and deployed the application on Hololens 2 and no configuration errors. I ran the app and started the anchor session and no issues. However, when I try to create an anchor by clicking on the create anchor button, the application closes directly, and nothing happens.

I am using Unity 2021.3.16f1 LTS and Unity XR system with ASA 2.14.

I noticed that some developers have been facing the exact same problem as reported here: https://learn.microsoft.com/en-us/answers/questions/1414723/azure-spatial-anchors-are-not-successfully-created

I tried the suggested solutions, and they all failed.

So, then I went to the associated script (Anchor Module Script) of the create anchor button, and it looks like there are two warnings, as shown here in the picture:

User's image

I investigated the problem. One of the suggested solutions is to do the following:

Replace this code:

 yield return www.SendWebRequest();
        if (www.isNetworkError || www.isHttpError)
        {
            Debug.Log(www.error);
        }

By the following:

yield return www.SendWebRequest();
        if (www.UnityWebRequest.result == UnityWebRequest.Result.ConnectionError || www.result == UnityWebRequest.Result.ProtocolError)
        {
            Debug.Log(www.error);
        }

So I did so, and now I got another major error: Severity Code Description Project File Line Suppression State Error CS1061 'UnityWebRequest' does not contain a definition for 'UnityWebRequest' and no accessible extension method 'UnityWebRequest' accepting a first argument of type 'UnityWebRequest' could be found (are you missing a using directive or an assembly reference?)

So, to solve the error, I replaced (www.UnityWebRequest.result == UnityWebRequest.Result.ConnectionError ) with this (www.result == UnityWebRequest.Result.ConnectionError )

This solved the error, but it still same issue,i.e., the application crashed every time I created an anchor. Please, any help? Any suggestions?

Your help is immensely appreciated!

Please, any help? Any suggestions?

Your help is immensely appreciated!!

HoloLens | Development
Community Center | Not monitored
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.