/// <summary>
    /// Called to begin the process of importing pending anchor data
    /// </summary>
    private void RequestAnchorDataCompleted(GenericNetworkTransmitter sender, RequestDataCompletedArgs args)
    {
        lock (ImportingAndExportingLock)
        {
            if (!args.Successful)
            {
                Debug.LogErrorFormat("[NetworkAnchorManager] Failed to receive anchor data. {0}", DebugInfo());
                ImportAnchorDataCompleted(null);
                return;
            }

            if (args.Data == null || args.Data.Length == 0)
            {
                Debug.LogErrorFormat("[NetworkAnchorManager] Binary anchor data is null or empty, ignoring request to import anchor data. {0}", DebugInfo());
                ImportAnchorDataCompleted(null);
                return;
            }

            if (args.RequestId != ImportingAnchorSource.AnchorId)
            {
                Debug.LogErrorFormat("[NetworkAnchorManager] Received data for anchor, but no longer importing this anchor id. (received anchor: {0}), {1}", DebugInfo());
                ImportAnchorDataCompleted(null);
                return;
            }
        }

        StartImportingAnchor(args.RequestId, args.Data);
    }
Esempio n. 2
0
    /// <summary>
    /// Called to begin the process of importing pending anchor data
    /// </summary>
    private void RequestAnchorDataCompleted(GenericNetworkTransmitter sender, RequestDataCompletedArgs args)
    {
        if (!args.Successful)
        {
            Debug.LogErrorFormat("[NetworkAnchorManager] Failed to receive anchor data. {0}", DebugInfo());
            ImportAnchorDataCompleted(null);
            return;
        }

        if (args.Data == null || args.Data.Length == 0)
        {
            Debug.LogErrorFormat("[NetworkAnchorManager] Binary anchor data is null or empty, ignoring request to import anchor data. {0}", DebugInfo());
            ImportAnchorDataCompleted(null);
            return;
        }

        Debug.LogFormat("[NetworkAnchorManager] Starting import of binary anchor data. (bytes: {0}) {1}", args.Data.Length, DebugInfo());
        WorldAnchorTransferBatch.ImportAsync(args.Data, BatchImportAsyncCompleted);
    }