Azure / azure-spatial-anchors-samples

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

Demo State: Check Unity Config #365

Open 1uan-yuan opened 2 years ago

1uan-yuan commented 2 years ago

I tried to implement the unity demo on hololens2. Luckily, I could successfully implement it on the device. However, when I followed the tutorial, "select BasicDemo using the arrows, then press the Go! button to run the demo", the program would stuck at this stage. It says, "Demo State: Check Unity Config". I waited several minutes, and nothing happened. Is this supposed to be normal? Is so, what should I do next? Are there any other tutorials that I could follow? Or did I miss some details?

Any suggestions would be appreciated!

1uan-yuan commented 2 years ago

I double checked the scripts. However, I didn't find any information about this message (Demo State: Check Unity Config). Could you please tell me where I can find this log?

Any other information would also be helpful!

XiangyuL-Microsoft commented 2 years ago

This text is not in script, look at there: https://github.com/Azure/azure-spatial-anchors-samples/blob/914e32e1abfe64369eae9208d91070c23d8cd437/Unity/Assets/AzureSpatialAnchors.Examples/Scenes/AzureSpatialAnchorsBasicDemo.unity#L1336

1uan-yuan commented 2 years ago

OK, I understand. But why this would appear? What should I do to fix this? Is there any advice? : )

1uan-yuan commented 2 years ago

Situation update: I tried to find out why this would happen and wanted to debug it. I updated the Spatial Anchor Id, Key and Domain to every Scenes. After re-building it again, the words are still there (Demo State: Check Unity Config).

Basic demo: nothing changed Nearby demo: nothing changed Local Shared demo: although the words are still there (Demo State: Check Unity Config), there are other options: Create & Share Anchor and Locate Shared Anchor. When I click into Create & Share Anchor, the program would have these words: Next: Create CloudSpatialAnchorSession. Then it would freeze. Nothing would happen. I have to click Back option to go to the upper layer. CoarseRelocDemo: I could find two new options: Delete Only New Anchor and Next step. And it says: Could not obtain identifier for anchor that was just created.

I could still find the words: Demo State: Check Unity Config. Is this supposed to be normal? Any suggestion would be helpful!

1uan-yuan commented 2 years ago

The attachment is unityplayer.log file.

Any suggestion would be helpful! UnityPlayer.log

XiangyuL-Microsoft commented 2 years ago

The attachment is unityplayer.log file.

Any suggestion would be helpful! UnityPlayer.log

Could you please provide more details information about:

  1. Unity Editor version
  2. OS version
  3. Any other information could be helpful for reproducing the problem.

Thanks

1uan-yuan commented 2 years ago

I used Unity 2020.3.37f1 to run this program. OS is Win10.

XiangyuL-Microsoft commented 2 years ago

I used Unity 2019.4.40f1 to run this program. OS is Win10.

What device are you running the sample app? HoloLens 2? Do you have the OS version of HL2?

1uan-yuan commented 2 years ago

It was Hololens2.

XiangyuL-Microsoft commented 2 years ago

It was Hololens2.

Have you update the OS on HL2 to most recent version? Is it possible for you to use Unity and configure it by following this page?

1uan-yuan commented 2 years ago

OK, I will try to do so.

On the other hand, I have another question. It's about the program in Hololens/DirectX.

I would like to create a file in Hololens and use this file to store the m_targetId. Here is the code that I use to store it. I made this modification in ViewController.cpp.

........
m_titleText = L"cloud anchor saved with ID " + m_targetId;
ofstream file("anchors.txt");
file << to_string(m_targetId); 
file.flush(); // file flush
file.close();
...........

I thought this is C++ file, so I used C++ methods to create a file and write strings into it. However, I could not find this file, and I have trouble reading from it.

1uan-yuan commented 2 years ago

Update: I followed the tutorial and finished implementing. The program was still not working as expected. When I tried to click on buttons as usual, the button is not responding.

XiangyuL-Microsoft commented 2 years ago

OK, I will try to do so.

On the other hand, I have another question. It's about the program in Hololens/DirectX.

I would like to create a file in Hololens and use this file to store the m_targetId. Here is the code that I use to store it. I made this modification in ViewController.cpp.

........
m_titleText = L"cloud anchor saved with ID " + m_targetId;
ofstream file("anchors.txt");
file << to_string(m_targetId); 
file.flush(); // file flush
file.close();
...........

I thought this is C++ file, so I used C++ methods to create a file and write strings into it. However, I could not find this file, and I have trouble reading from it.

Actually, you are working a UWP app, have you referenced this doc? I would recommend Windows.Storage other than C++ std::ios.

Besides, I would suggest that open a new issue to tracking the problem.

ArDevKarl commented 1 year ago

I have the same issue using HL2. Using unity 2020.3.42f1 and installed the latest updates to all required Packages and HoloLens 2 OS.

I'm using the latest HEAD / v2.13.0

I found this in the UnityPlayer.log:

Plugins: Failed to load 'C:/data/Programs/WindowsApps/Template3D_1.0.0.0_arm64__ph1m9x8skttmg/AzureSpatialAnchors.dll' because one or more of its dependencies could not be loaded. Plugins: 2nd attempt to load module with '.dll' extension manually appended ('AzureSpatialAnchors.dll.dll') also couldn't be found (or it's dependencies). Module information: Built with Compiler Ver '192528614' Built from '2020.3/staging' branch Version is '2020.3.42f1 (7ade1201f527)' Release build Application type 'D3D' OS 'Windows 10 (10.0.20348) 64bit'

...

_"DemoScriptBase - Error in AdvanceDemo: Unable to load DLL 'AzureSpatialAnchors': The specified module could not be found. at Microsoft.Azure.SpatialAnchors.CloudSpatialAnchorSession..ctor () [0x00000] in <00000000000000000000000000000000>:0 at Microsoft.Azure.SpatialAnchors.Unity.SpatialAnchorManager+d_36.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext (System.Object stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.Windows.Speech.DictationRecognizer+DictationHypothesisDelegate.Invoke (System.String text) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state"

...

The playerlog of xueyuancao0218 in a previuos commment shows the same error

UnityPlayer.log

darax commented 1 year ago

Hi @ARDevKarl, I updated the Unity sample code with release 2.14.1. Make sure to install the OpenXR plugin from unity and use the MixedRealityFeatureTool to install the Microsoft OpenXR Plugin. The DLL it is most likely looking for is the OpenXR dll.