/// <summary> /// This is invoked once we've finished exported the binary anchor data to a byte array. /// </summary> private void ExportAnchorDataComplete( SerializationCompletionReason status, byte[] data, String anchorId, GameObject gameObject) { if (status == SerializationCompletionReason.Succeeded) { Debug.LogFormat("[NetworkAnchorManager] Exporting anchor succeeded. (anchor id: {0}) (bytes: {1}) {2}", anchorId, data.Length, DebugInfo()); anchorTransmitter.SendData(data); } else { Debug.LogErrorFormat("[NetworkAnchorManager] Exporting anchor failed, going to retrying. (anchor id: {0}) (status: {1}) (bytes: {2}) {3}", anchorId, status, data.Length, DebugInfo()); StartCoroutine(RetrySharingAnchor(anchorId, gameObject)); } }
/// <summary> /// This is invoked once we've finished exported the binary anchor data to a byte array. /// </summary> private void ExportAnchorDataComplete( int attempts, SerializationCompletionReason status, byte[] data, String anchorId, GameObject gameObject, ExportingAnchorCompleteDelegate completeDelegate) { ExportingAnchorResult result = ExportingAnchorResult.Unknown; lock (ImportingAndExportingLock) { if (ImportingAnchorSource.IsValid || ImportedAnchor != null) { Debug.LogFormat("[NetworkAnchorManager] Exporting anchor completed, but local client is now using a remote anchor. (anchor id: {0}) (bytes: {1}) (export result: {2}) {3}", anchorId, data.Length, status.ToString(), DebugInfo()); result = ExportingAnchorResult.FailedTimedOut; } else if (ExportingAnchorSource.AnchorId != anchorId) { Debug.LogFormat("[NetworkAnchorManager] Exporting anchor completed, but exporting anchor id changed. (anchor id: {0}) (bytes: {1}) {2}", anchorId, data.Length, DebugInfo()); result = ExportingAnchorResult.FailedInvalidAnchorId; } else if (status == SerializationCompletionReason.Succeeded) { Debug.LogFormat("[NetworkAnchorManager] Exporting anchor succeeded. (anchor id: {0}) (bytes: {1}) {2}", anchorId, data.Length, DebugInfo()); anchorTransmitter.SendData(data); result = ExportingAnchorResult.Success; ExportingAnchorSource = SharedAnchorData.Empty; } else { Debug.LogErrorFormat("[NetworkAnchorManager] Exporting anchor failed, going to retry. (anchor id: {0}) (status: {1}) (bytes: {2}) {3}", anchorId, status, data.Length, DebugInfo()); StartCoroutine(RetrySharingAnchor(attempts, anchorId, gameObject, completeDelegate)); } } if (result != ExportingAnchorResult.Unknown && completeDelegate != null) { completeDelegate(anchorId, gameObject, result); } }