private void ServerFixedUpdate() { BotCache.ForEachId(id => { byte[] packet = BotCache.TakeExtra <byte[]>(id, BotCache.Extra.NetworkedPhysics); if (packet == null) { return; } _sharedBuffer.SetContents(packet); if (_sharedBuffer.TotalBitsLeft >= BotState.InputSerializedBitsSize) { BotState.DeserializePlayerInput(_sharedBuffer, out Vector3 movementInput, out Vector3 trackedPosition); BotCache.Get(id).UpdateInputOnly(movementInput, trackedPosition); } }); Simulate(TimestepMillis); if (NetworkServer.ClientCount > 0) { int bitSize = 48 + BotState.SerializedBitsSize * BotCache.Count; _sharedBuffer.ClearContents(new byte[(bitSize + 7) / 8]); _sharedBuffer.WriteTimestamp(DoubleProtocol.TimeMillis); BotCache.ForEach(structure => structure.SerializeState(_sharedBuffer)); NetworkServer.UdpPayload = _sharedBuffer.Array; } else { NetworkServer.UdpPayload = null; } }