AddWorldAnchor() public method

Adds a WorldAnchor to the batch with the specified identifier.

public AddWorldAnchor ( string id, WorldAnchor anchor ) : bool
id string The identifier associated with this anchor in the batch. This must be unique per batch.
anchor UnityEngine.VR.WSA.WorldAnchor The anchor to add to the batch.
return bool
    /// <summary>
    /// If we are supposed to create the anchor for export, this is the function to call.
    /// </summary>
    public void CreateAnchor()
    {
        objectToAnchor = SharedCollection.Instance.gameObject;
        WorldAnchorTransferBatch watb = new WorldAnchorTransferBatch();
        WorldAnchor worldAnchor = objectToAnchor.GetComponent<WorldAnchor>();
        if (worldAnchor == null)
        {
            worldAnchor = objectToAnchor.AddComponent<WorldAnchor>();
        }

        exportingAnchorName = Guid.NewGuid().ToString();
        Debug.Log("exporting " + exportingAnchorName);
        watb.AddWorldAnchor(exportingAnchorName, worldAnchor);
        WorldAnchorTransferBatch.ExportAsync(watb, WriteBuffer, ExportComplete);
    }