using Unity.Burst; using Unity.Collections; using Unity.Jobs; using Unity.Networking.Transport; using UnityEngine; namespace ECSTest { [BurstCompile] public struct ClientUpdateJob : IJob { public NetworkDriver driver; public NetworkPipeline unreliablePipeline; public NetworkPipeline reliablePipeline; public NativeReference connection; public void Execute() { if (connection.Value == default) return; NetworkEvent.Type cmd; while ((cmd = connection.Value.PopEvent(driver, out var stream, out var networkPipeline)) != NetworkEvent.Type.Empty) { if (cmd == NetworkEvent.Type.Data) { //TODO } else if (cmd == NetworkEvent.Type.Connect) { Debug.Log("[Client] Connected to server"); //TODO } else if (cmd == NetworkEvent.Type.Disconnect) { connection.Value = default; Debug.Log("[Client] Disconnected to server"); } } } } }