You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Local Anchor Transfer over the WorldAnchorTransferBatch,as Described in the Link below, can not be used in Unity 2020 anymore.
https://docs.microsoft.com/en-us/windows/mixed-reality/out-of-scope/local-anchor-transfers-in-unity
Is there another way for Exporting/Importing Anchors on the Hololens without using Azure Spatial Anchors.
I also wonder about this. You can use the OpenXR version which is currently also getting deprecated and looks to still work with the newest version of Unity for now (2022.1), although I am still in the process of currently testing if that's true.
https://learn.microsoft.com/en-us/dotnet/api/microsoft.mixedreality.openxr.xranchortransferbatch?view=mixedreality-openxr-plugin-1.7
It is very unfortunate that we are getting pigeon-holed into only having this ability with Azure Spatial Anchors and vendor-locking the community.
Hello
@scheurik
, thanks for the tip! I am currently trying this as well (need to find an off-line way to share spatial anchors between several hololens 2 headsets running my Unity apps, without using azure cloud). I have trouble creating an anchor for my "root game object" - I'm rather new to hololens so I could use a few tips.
I have naievly just attached an ARAnchor component to my root gameObject and tried to export it using XRAnchorTransferBatch, but AddAnchor returns false and and ExportAsync returns a null stream.
Here is my test code, in case it helps:
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Microsoft.MixedReality.OpenXR;
using UnityEngine.XR.ARFoundation;
using Microsoft.MixedReality.Toolkit.Utilities;
using System.IO;
using System.Threading.Tasks;
public class WorldAnchorMaster : MonoBehaviour
ARAnchor arAnchor;
void Start()
arAnchor = GetComponent<ARAnchor>();
void Update()
if (Input.GetKeyDown(KeyCode.Space)) ExportGameRootAnchor();
public async void ExportGameRootAnchor()
XRAnchorTransferBatch transferBatch = new XRAnchorTransferBatch();
var result = transferBatch.AddAnchor(arAnchor.trackableId, "gameRoot");
print("Add result: " + result); // result: false
foreach (var name in transferBatch.AnchorNames) print("Anchor: " + name);
var stream = await XRAnchorTransferBatch.ExportAsync(transferBatch);
await Task.Delay(5000);
print("Stream: " + stream); // result: null
print("Stream is null? " + (stream == null)); // result: yes
print("Stream length: " + stream.Length); // throws undefined ref
byte[] bytesInStream = new byte[stream.Length];
using (FileStream fileStream = File.Create("anchor.txt", (int)stream.Length))
stream.Read(bytesInStream, 0, (int)bytesInStream.Length);
fileStream.Write(bytesInStream, 0, bytesInStream.Length);
if (UDPReceiver.Instance.SendByteArray(bytesInStream))
print("USB send successful");
print("USB print failed");
Did you succeed in sharing anchors via XRAnchorTransferBatch as you suggested? If so, how did you create/obtain the anchors you shared?
I am about to dig into this: https://learn.microsoft.com/en-us/windows/mixed-reality/develop/unity/spatial-anchors-in-unity?tabs=anchorstore
Do you think it is a good idea or would you recommend something else?
Cheers,
Xavier