Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

How To WorldAnchor Export And Import?

chanmobchanmob
edited February 2018 in Questions And Answers
private WorldAnchorStore anchorStore = null;
private WorldAnchor worldAnchor;
private WorldAnchorTransferBatch transferBatch;

private List<byte> exportingAnchorBytes = new List<byte>();

private void ExportWorldAnchor()
{
transferBatch = new WorldAnchorTransferBatch();
transferBatch.AddWorldAnchor("GameRootAnchor", worldAnchor);
WorldAnchorTransferBatch.ExportAsync(transferBatch, OnExportDataAvailable, OnExportComplete);
}

private void OnExportComplete(SerializationCompletionReason completionReason)
{
    if (completionReason != SerializationCompletionReason.Succeeded)
    {

    }

    else
    {

    }
}

private void OnExportDataAvailable(byte[] data)
{
    exportingAnchorBytes.AddRange(data);
}

// This byte array should have been updated over the network from TransferDataToClient
private byte[] importedData;
private int retryCount = 3;

private void ImportRootGameObject()
{
    WorldAnchorTransferBatch.ImportAsync(importedData, OnImportComplete);
}

private void OnImportComplete(SerializationCompletionReason completionReason, WorldAnchorTransferBatch deserializedTransferBatch)
{
    if (completionReason != SerializationCompletionReason.Succeeded)
    {
        Debug.Log("Failed to import: " + completionReason.ToString());
        if (retryCount > 0)
        {
            retryCount--;
            WorldAnchorTransferBatch.ImportAsync(importedData, OnImportComplete);
        }
        return;
    }

    worldAnchor = deserializedTransferBatch.LockObject("gameRoot", this.gameObject);
}

I don't know how to impot, export worldanchor

1) i saw transferdatatoclient in example but i don't know how to realize TransferDataToClient(data) on OnExportDataAvailable

2) how to set importData(byte[])

help me, plz....!!!

Sign In or Register to comment.