When are Spatial Anchors deleted from WorldAnchorStore

When I deploy different scenes, apps, or just different versions of my code, sometimes the WorldAnchorStore does not have the entries which were there in previous runs.

Are World Anchors local to each app? Each Scene?
How does the standard build process using Visual Studio 2017 configure what is a new instance of the app, losing all your WorldAnchors?

The WorldAnchorManager does have "Persistent Anchors" enabled, and I see in the logs the successful creation of anchors.. but those anchors later disappear.

My specific case is one Unity 2017.2.1f1 project with two scenes. When deployed, one scene is successfully making WorldAnchors, but when i deploy and run the next scene (exported, deployed (over Wifi) separately, with no config changes except exporting one scene instead of the other) it can't find any of the WorldAnchors from the first scene.

Tagged:

Best Answer

  • stepan_stulovstepan_stulov ✭✭✭
    edited January 2018 Accepted Answer

    Hey, @jethrogillgren.

    WorldAnchorStore is a local storage of world anchors for one single app. Each app will have its own, completely isolated from others, anchor store. Anchor store is meant for persisting of world anchors between application relaunches and not survive application redeployments. A redeployed app is a different app that happens to have the same ID and by the the very fact of its existence having overwritten the old one.

    From my experience, world anchor store is cleared when your app is redeployed and your app's checksum is different. Checksum will be different if you change code, change assets or alter your project in any other way that influences it. Simply redeploying exactly the same app from within Visual Studio will just relaunch it, not redeploy it.

    I believe that switching the build scene heavily alters the checksum. Also bear in mind that scenes is a Unity concept. Once Unity outputs a Visual Studio project, there are no more scenes in the same sense. There is a new app with new resource management resembling something like scenes. While anchor store is UWP/Visual Studio concept, whereby a project could theoretically be built from another tool/engine having no concept of scenes at all.

    In short:

    • Uninstalling the app = clearing anchor store
    • Re-installing the app with different checksum = clearing anchor store
    • Re-installing the app with the same checksum = preserves anchor store

    I believe what you may be looking for is not an app-dependent anchor store, but a freely serializable, deserializable and transferrable WorldAnchorTransferBatch. It goes beyond different scenes within the same app. You can use anchors established on one HoloLens from within another HoloLens. This principle is, for example, at the heart of SharingService of the HoloToolkit, where a transfer batch with one anchor is passed from one HoloLens to another to sync their coordinate systems.

    Hope this helps.

    Building the future of holographic navigation. We're hiring.

Answers

  • stepan_stulovstepan_stulov ✭✭✭
    edited January 2018 Accepted Answer

    Hey, @jethrogillgren.

    WorldAnchorStore is a local storage of world anchors for one single app. Each app will have its own, completely isolated from others, anchor store. Anchor store is meant for persisting of world anchors between application relaunches and not survive application redeployments. A redeployed app is a different app that happens to have the same ID and by the the very fact of its existence having overwritten the old one.

    From my experience, world anchor store is cleared when your app is redeployed and your app's checksum is different. Checksum will be different if you change code, change assets or alter your project in any other way that influences it. Simply redeploying exactly the same app from within Visual Studio will just relaunch it, not redeploy it.

    I believe that switching the build scene heavily alters the checksum. Also bear in mind that scenes is a Unity concept. Once Unity outputs a Visual Studio project, there are no more scenes in the same sense. There is a new app with new resource management resembling something like scenes. While anchor store is UWP/Visual Studio concept, whereby a project could theoretically be built from another tool/engine having no concept of scenes at all.

    In short:

    • Uninstalling the app = clearing anchor store
    • Re-installing the app with different checksum = clearing anchor store
    • Re-installing the app with the same checksum = preserves anchor store

    I believe what you may be looking for is not an app-dependent anchor store, but a freely serializable, deserializable and transferrable WorldAnchorTransferBatch. It goes beyond different scenes within the same app. You can use anchors established on one HoloLens from within another HoloLens. This principle is, for example, at the heart of SharingService of the HoloToolkit, where a transfer batch with one anchor is passed from one HoloLens to another to sync their coordinate systems.

    Hope this helps.

    Building the future of holographic navigation. We're hiring.

  • Thank-you for that brilliantly detailed response! It was the distinction between Redeploying with and without changes that threw me. Such a clear answer, thankyou again.

Sign In or Register to comment.