/// <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); }
/// <summary> /// Ensures that the scene has what we need to continue. /// </summary> /// <returns>True if we can proceed, false otherwise.</returns> private bool CheckConfiguration() { networkTransmitter = GenericNetworkTransmitter.Instance; if (networkTransmitter == null) { Debug.Log("No UNetNetworkTransmitter found in scene"); return(false); } networkManager = NetworkManager.singleton; if (networkManager == null) { Debug.Log("No NetworkManager found in scene"); return(false); } if (SharedCollection.Instance == null) { Debug.Log("No SharedCollection found in scene"); return(false); } else { objectToAnchor = SharedCollection.Instance.gameObject; } return(true); }
/// <summary> /// Initialize the anchor transmitter only once /// </summary> private void InitializeAnchorTransmitterOnce() { if (anchorTransmitter == null) { anchorTransmitter = new GenericNetworkTransmitter(); anchorTransmitter.RequestDataCompleted += RequestAnchorDataCompleted; } }
/// <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); }
/// <summary> /// Ensures that the scene has what we need to continue. /// </summary> /// <returns>True if we can proceed, false otherwise.</returns> private bool CheckConfiguration() { networkTransmitter = GenericNetworkTransmitter.Instance; if (networkTransmitter == null) { Debug.Log("No UNetNetworkTransmitter found in scene"); return false; } networkManager = NetworkManager.singleton; if (networkManager == null) { Debug.Log("No NetworkManager found in scene"); return false; } if (SharedCollection.Instance == null) { Debug.Log("No SharedCollection found in scene"); return false; } else { objectToAnchor = SharedCollection.Instance.gameObject; } return true; }