microsoft / MixedReality-WorldLockingTools-Unity

Unity tools to provide a stable coordinate system anchored to the physical world.
https://microsoft.github.io/MixedReality-WorldLockingTools-Unity/README.html
MIT License
188 stars 45 forks source link

OpenXR Persistence on hololens does not work. #322

Open Peamon opened 9 months ago

Peamon commented 9 months ago

With at least unity 2021.3.6, OpenXR with mixedreality openxr 1.10 and worldlockingtools 1.5.9 and master, compiled in UWP64 for hololens 2.

The persistance of the anchor does not work, and WorldLockingManager.GetInstance().AnchorManager.SupportsPersistence is false

To make it works, simply change the line 225 of file WorldLocking.Core/Scripts/XR/AnchorManagerXR.cs

from :

openXRPersistence = XRGeneralSettings.Instance.Manager.activeLoader.name.StartsWith("Open XR");

to:

openXRPersistence = XRGeneralSettings.Instance.Manager.activeLoader.name.StartsWith("OpenXR");

(juste remove a space !!!)

The effective name of activeLoader is OpenXRLoader as shown in logs :

ActiveLoader name:[OpenXRLoader] type:[UnityEngine.XR.OpenXR.OpenXRLoader]
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
Microsoft.MixedReality.WorldLocking.Core.AnchorManagerXR:.ctor(IPlugin, IHeadPoseTracker, XRAnchorSubsystem, XRSessionSubsystem)
Microsoft.MixedReality.WorldLocking.Core.<TryCreate>d__7:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(TStateMachine&)
Microsoft.MixedReality.WorldLocking.Core.<SelectAnchorManager>d__114:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(TStateMachine&)
Microsoft.MixedReality.WorldLocking.Core.<ResetAnchorManager>d__113:MoveNext()
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(TStateMachine&)
Microsoft.MixedReality.WorldLocking.Core.WorldLockingManager:SetContext(WorldLockingContext)
Microsoft.MixedReality.WorldLocking.Core.WorldLockingContext:CheckPushSettings(Scene)
Microsoft.MixedReality.WorldLocking.Core.WorldLockingContext:OnEnable()

It will be great if this can be corrected in the master !!!

the issue is also described here: https://forum.unity.com/threads/hololens-2-persist-anchors-with-world-locking-tools.1406428/

P422L commented 9 months ago

I tried implementing your fix but Persistence still isn't working. As soon as I restart the App on my Hololens2 everything resets. I have the WLT Debug options turned on so I can see that the Anchors are being created as I move around.

Unfortunately I'm unable to debug because the Hololens2 is from my University and I'm developing and building from my Home Workstation. Any further Ideas?