LockObject() public méthode

Locks the provided GameObject to the world by loading and applying the WorldAnchor from the TransferBatch for the provided id.

public LockObject ( string id, GameObject go ) : WorldAnchor
id string The identifier for the WorldAnchor to load and apply to the GameObject.
go UnityEngine.GameObject The GameObject to apply the WorldAnchor to. If the GameObject already has a WorldAnchor, it will be updated.
Résultat UnityEngine.VR.WSA.WorldAnchor
    /// <summary>
    /// Called when a remote anchor has been deserialized
    /// </summary>
    /// <param name="status">Tracks if the import worked</param>
    /// <param name="wat">The WorldAnchorTransferBatch that has the anchor information.</param>
    private void ImportComplete(SerializationCompletionReason status, WorldAnchorTransferBatch wat)
    {
        if (status == SerializationCompletionReason.Succeeded && wat.GetAllIds().Length > 0)
        {
            Debug.Log("Import complete");
            
            string first = wat.GetAllIds()[0];
            Debug.Log("Anchor name: " + first);

            WorldAnchor existingAnchor = objectToAnchor.GetComponent<WorldAnchor>();
            if (existingAnchor != null)
            {
                DestroyImmediate(existingAnchor);
            }

            WorldAnchor anchor = wat.LockObject(first, objectToAnchor);
            WorldAnchorManager.Instance.AnchorStore.Save(first, anchor);
            ImportInProgress = false;
            AnchorEstablished = true;
        }
        else
        {
            // if we failed, we can simply try again.
            gotOne = true;
            Debug.Log("Import fail");
        }
    }