MixedRealityToolkit-Unity: World Anchor Store never ready
I stumbled upon this problem yesterday, when i first got into world anchors. Basically what i tried is to get the World Anchor Manager working, but the problem i had is that the callback when the anchor store is ready never got called. So i thought maybe i just messed up and created a new project with just the spatialmapping and world anchor store manager in it. Well the end of the story was that it still didnt work.
So i fiddled around a little bit and changed:
protected override void Awake()
{
base.Awake();
AnchorStore = null;
WorldAnchorStore.GetAsync(AnchorStoreReady);
}
to
void Start()
{
AnchorStore = null;
WorldAnchorStore.GetAsync(AnchorStoreReady);
}
Basically i let the code in the Awake() function run in the Start() function. Maybe there is something not yet initialized when Awake() gets called, cause i also got an NullReference Error.
Is this a bug? Should the code in Awake() run in the Start() function?
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 22 (10 by maintainers)
FYI, currently a unity bug associated to this.
[WSA] WORLDANCHORSTORE.GETASYNC THROWS AN EXCEPTION WHEN STARTING DEPLOYED HOLOLENS APP BUILT
If you have problems or questions please post them here HoloLens Forum.
Try this:
It has been helpful for me to add an event on
WorldAnchorManagerthat gets fired whenWorldAnchorStore.GetAsynccompletes.I can also confirm this became a problem for us after upgrading to Unity 5.6. Also, “Fixed” by moving the call to GetAsync to the Start method instead of Awake.
Can confirm this. My world anchor store was not working becasue GetAsync never invoked the ready callback. “Fixed” it by moving the call to GetAsync to the Start method instead of Awake.
I just had the same! I am using the ImportExportAnchorManager. The callback to AnchorStoreReady was never called. Finally moved the GetAsync call to Start and no everything works as expected!
Can confirm too. Moving GetAsync to start fixed it, although it is not necessarily ideal since scripts such as TapToPlace.cs may rely on the anchorstore being ready when Start() is called. A temporary solution is to delay the execution of such scripts in the meanwhile.
You might want to contribute to this thread: https://forum.unity3d.com/threads/error-running-in-hololens.449303/
The WorldAnchorManager should work just fine as it is.
As far as I know, the WorldAnchorStore callback (AnchorStoreReady here) is never fired within the Unity Editor. You have to deploy to HoloLens.
What is the NullReferenceException about ?