Azure / azure-spatial-anchors-samples

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

StartSessionAsync needs to be called after a delay #70

Closed ashikns closed 4 years ago

ashikns commented 5 years ago

I created a script that inherits from SpatialAnchorManager and then called StartSessionAsync from Start() (after base.Start() of course). A session is created successfully but it never scans any frames. If I call StartSessionAsync after a delay of 3 seconds via a coroutine it works. Using sdk version 1.3.2 on Unity 2019.1.14f1, building for Android using Unity built-in sdk.

Here's my take on it: With SDK version 1.3 the api has been moved to use ARFoundation which is a great move imo. In the earlier version where ARCore sdk from Google was used there was this issue that you have to wait until ARCore launches it's own session and assign it to ASA native session before launching ASA session. With the new sdk I don't see a way to do this cleanly. This problem never pops up in the sample because the sample has a bunch of steps to go through before launching the ASA session thereby creating an artificial delay.

Merichbier commented 5 years ago

I also remarked this bug, my Hack was to create a IsReady attribute and set it only to true when SpatialAnchorsManager was ready

            base.Start();
            while (!await IsValidateConfiguration())
            {
            }

            _spatialAnchorsManagerReady = true;

This however doesn't prevent other script from starting a session when it is not ready and isn't really clean.. But haven't had any other idea to hack this issue

vriveras commented 5 years ago

We have a fix for this issue coming in the next release.

craigktreasure commented 4 years ago

This should have been fixed. Please update to 2.0.0 and report back on any further related issues.