/// <summary> /// Sends the anchor to a client. /// </summary> /// <param name="client">The client connection to send the anchor to.</param> public void SendAnchor(Socket client) { #if UNITY_WSA && !UNITY_EDITOR if (exportingAnchorBytes != null && IsAnchorEstablished) { // Send existing anchor data to clients var Command = new MessageWorldAnchor(exportingAnchorBytes.ToArray()); Services.NetworkManager().Network.SendToClient(Command.Pack(), client); } else { // create new anchor and send it to clients CreateAnchor(); } #endif }
/// <summary> /// Called when serializing an anchor is complete. /// </summary> /// <param name="status">If the serialization succeeded.</param> private void ExportComplete(SerializationCompletionReason status) { if (status == SerializationCompletionReason.Succeeded && exportingAnchorBytes.Count > MinTrustworthySerializedAnchorDataSize) { AnchorName = exportingAnchorName; anchorData = exportingAnchorBytes.ToArray(); ////createdAnchor = true; Debug.Log("Anchor ready " + exportingAnchorBytes.Count); IsAnchorEstablished = true; // Send anchor data to clients var command = new MessageWorldAnchor(exportingAnchorBytes.ToArray()); Services.NetworkManager().SendMessage(command.Pack()); } else { Debug.Log("Create anchor failed " + status + " " + exportingAnchorBytes.Count); exportingAnchorBytes.Clear(); DestroyImmediate(ObjectToAnchor.GetComponent <WorldAnchor>()); CreateAnchor(); } }