public virtual void RestoreWorldAnchor(string anchorId, AnchorRestoredDelegate anchorRestored) { if (anchorRestored != null) { anchorRestored(null, "RestoreAnchorNotSupported"); } }
/// <summary> /// Restores the world anchor. /// </summary> /// <param name="anchorId">Anchor identifier.</param> /// <param name="anchorRestored">Delegate invoked after the anchor gets restored.</param> public void RestoreWorldAnchor(string anchorId, AnchorRestoredDelegate anchorRestored) { if (arInterface != null) { arInterface.RestoreWorldAnchor(anchorId, anchorRestored); } }
public override void RestoreWorldAnchor(string anchorId, AnchorRestoredDelegate anchorRestored) { if (isDisplayOpaque) { base.RestoreWorldAnchor(anchorId, anchorRestored); return; } if (string.IsNullOrEmpty(anchorId)) { if (anchorRestored != null) { anchorRestored(null, "InvalidAnchorId"); } return; } if (memBuffer == null || memBuffer.Length == 0) { if (anchorRestored != null) { anchorRestored(null, "AnchorDataNotSet"); } return; } WorldAnchorTransferBatch.ImportAsync(memBuffer, (result, batch) => { GameObject anchorObj = null; if (result == SerializationCompletionReason.Succeeded) { anchorObj = new GameObject(anchorId); batch.LockObject(anchorId, anchorObj); } if (anchorRestored != null) { anchorRestored(result == SerializationCompletionReason.Succeeded ? anchorObj : null, result == SerializationCompletionReason.Succeeded ? string.Empty : result.ToString()); } }); }
/// <summary> /// Restores the world anchor. /// </summary> /// <param name="anchorId">Anchor identifier.</param> /// <param name="anchorRestored">Delegate invoked after the anchor gets restored.</param> public override void RestoreWorldAnchor(string anchorId, AnchorRestoredDelegate anchorRestored) { if (string.IsNullOrEmpty(anchorId)) { if (anchorRestored != null) { anchorRestored(null, "InvalidAnchorId"); } return; } XPSession.ResolveCloudAnchor(anchorId).ThenAction(result => { if (anchorRestored != null) { anchorRestored(result.Response == CloudServiceResponse.Success ? result.Anchor.gameObject : null, result.Response == CloudServiceResponse.Success ? string.Empty : result.Response.ToString()); } }); }