# Spatial Anchor Storage System Not Working

**URL:** <https://forum.magicleap.cloud/t/spatial-anchor-storage-system-not-working/6368>\
**Category:** Spatial Anchors\
**Tags:** unity, anchors\
**Created:** [September 24, 2025, 2:29pm UTC](https://forum.magicleap.cloud/t/spatial-anchor-storage-system-not-working/6368 "2025-09-24T14:29:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luke](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@luke](https://forum.magicleap.cloud/u/luke)\
**Post date:** [September 24, 2025, 2:29pm UTC](https://forum.magicleap.cloud/t/spatial-anchor-storage-system-not-working/6368/1 "2025-09-24T14:29:45Z")

</div>

Hello! I am working on a magic leap 2 app that is contingent on the ability to create and store spatial anchors for a very long time. Anchors that can be restored in the space months or even years after creation.

I have been using the example script provided here:

> **[Spatial Anchor Example | MagicLeap Developer Documentation](https://developer-docs.magicleap.cloud/docs/guides/unity-openxr/spatial-anchors/unity-spatial-anchor-example/)**
>
> This section includes an example of using Unity's AR Foundation to create local anchors on the Magic Leap 2 headset.

However I have been having issues with the storage functionality. The spatial anchor storage script does not properly store any anchors. Sometimes the anchors created in one instance of my application will persist until the next time I open the app (I tested this by creating anchors, closing the app and immediately opening again to check it), but not all of the anchors would persist, and none of the anchors would persist more than one time reopening the application (that is, if an anchor persisted and was visible after opening the app, closing and opening the app would cause that anchor to be permanently deleted). And I’m unsure what’s causing this issue.

I saw this post on these forums about issues with spatial anchor tracking in some versions of Unity.

> [@Spatial Anchors Not Tracking](https://forum.magicleap.cloud/t/spatial-anchors-not-tracking/3614):
>
> Guys good day to you! For some reason the Spatial Anchors do not seem to be tracking at all. I'm using the code in the link below & without the storage piece since I want to explain how they work before adding the persistent aspect of it. I also simplified the Update method as shown below, but for some reason anchor.trackingState is always set to None? Normally this is either tracking or limited when I do exactly the same code on iOS devices. private void Update() { if (anchorManager.tr…

I am currently working in this environment.  
**6000.0.023f1** :  
**1.12.0** :  
**Android 10.0** :  
**Windows** : 10  
I have attempted to downgrade to Unity 2022.3.11f1 as the user suggested in his posts, however this downgrade creates a lot of errors. Is there any alternative to solve this issue? Is the example script deprecated in the current Unity updates?

Thank you.

(I should add, I have set up the AR anchor manager in the xr origin, ar anchor components on each new anchor as the script entails, and spatial anchor permissions are added, as well as spatial anchor subsystem for openXR added.)

---

<div class="post-metadata">

**Author:** ![cfeist](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/cfeist/32/1768_2.png) [@cfeist](https://forum.magicleap.cloud/u/cfeist)\
**Post date:** [September 24, 2025, 5:59pm UTC](https://forum.magicleap.cloud/t/spatial-anchor-storage-system-not-working/6368/2 "2025-09-24T17:59:19Z")

</div>

Hey @luke,

Sorry you’re running into issues!  
Luckily I have some suggestions that might help you.

1. The latest Magic Leap Examples Unity project is built with Unity 6 and includes an example scene with scrips that show how to create, store, and load anchors, so I would recommend checking that out to see if there is anything you might find useful in there. You can download the latest version (2.6.0) from the Magic Leap Hub 3.

2. You may already be doing this, but just note that in order to successfully create, save and load anchors, you need to be “localized” in your space. So ensure that you are localized before attempting to create and store anchors. You can find documentation and examples for this here [Localization Map Examples | MagicLeap Developer Documentation](https://developer-docs.magicleap.cloud/docs/guides/unity-openxr/localization-map/simple-example/)

Please let me know if these suggestions help at all!

Best,  
Corey

---

<div class="post-metadata">

**Author:** ![luke](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@luke](https://forum.magicleap.cloud/u/luke)\
**Post date:** [October 1, 2025, 12:38am UTC](https://forum.magicleap.cloud/t/spatial-anchor-storage-system-not-working/6368/3 "2025-10-01T00:38:04Z")

</div>

Hi Corey,

Thank you so much for your suggestion, it has been very helpful and insightful, I had neglected to check those Unity Examples, but they do run perfectly fine on the current version of unity and the version that I am running my project under, so it’s good to know that the issue is not with my unity version.

The spatial anchor storage example works perfectly when building directly from their examples, however I run into errors when inside my project, so the issue is likely caused by the environment. I was looking over the settings between both environments and found that this was the xr-plugin setup for the example project:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/9/9fcb620411106ea55025653261ac081256bee466.png)

While this was the setup for my project:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/d/da1cddee65a5c96d00de394a04681ff36e332480.png)

Naturally, I unticked magic leap and attempted to load the example within my project. It loaded fine and no visible errors were present, however I now have another issue. I cannot interact within the application. I am not sure if this is because I am building this app with MRTK3 plugins and there is some sort of conflict, but nothing works, the app accurately tracks my head and displays properly, but the controller does not work and neither does the hand tracking. This is what the openXR feature groups look like, this might be useful information:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/1/129c084ad0f5bba3c8675ffaf8b055bbb47ff4c9.png)

Thanks so much for your help.

---

<div class="post-metadata">

**Author:** ![luke](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@luke](https://forum.magicleap.cloud/u/luke)\
**Post date:** [October 1, 2025, 2:06pm UTC](https://forum.magicleap.cloud/t/spatial-anchor-storage-system-not-working/6368/4 "2025-10-01T14:06:54Z")

</div>

Update: I figured it out, I simply forgot to enable the proper interaction profiles in the OpenXR section. It looks as if the example scene works perfectly within my environment now, and I can work this script into my application, thanks so much for your help!

---

<div class="post-metadata">

**Author:** ![luke](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@luke](https://forum.magicleap.cloud/u/luke)\
**Post date:** [October 2, 2025, 10:36pm UTC](https://forum.magicleap.cloud/t/spatial-anchor-storage-system-not-working/6368/5 "2025-10-02T22:36:51Z")

</div>

Another Update! I was unfortunately mistaken, the interaction profiles fixed the issue of the controller not working, however the hand tracking and hand interaction simply will not work, even with these enabled interaction profiles.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/2X/6/6298fd3a68f3740795f6308672a226f928cf2cb0.png)

And turning on “Hand Tracking” and “Hand Interaction Poses” causes the program not to start.

It would be ideal if my application could use both the controller and the hand interaction, if you have any advice please do share!

Thanks!
