public void SendPacket(Packet packet, bool ignoreSelf = false) { byte[] bytePacket = ENSSerialization.SerializePacket(packet); foreach (NetworkPlayer player in NetServer.serverInstance.connections.ToArray()) { if (ignoreSelf && NetServer.serverInstance.myConnection == player) { continue; } if (packet.sendToAll || packet.usersToRecieve.Contains(player.clientID)) { bool outcome = SteamNetworking.SendP2PPacket(player.steamID, bytePacket, bytePacket.Length, 1, sendType: P2PSend.Unreliable); //Debug.Log(outcome); //udpServer.Send(bytePacket, bytePacket.Length, player.udpEndpoint); } } }
public void SendPacket(Packet packet) { byte[] bytePacket = ENSSerialization.SerializePacket(packet); bool outcome = SteamNetworking.SendP2PPacket(NetClient.instanceClient.serversSteamID, bytePacket, bytePacket.Length, 1, sendType: P2PSend.Unreliable); //Debug.Log(outcome); //client.Send(bytePacket, bytePacket.Length, serverEndpoint); #if UNITY_EDITOR if (NetClient.instanceClient.trackOverhead) { if (NetClient.instanceClient.overheadFilter == Packet.pType.unassigned || NetClient.instanceClient.overheadFilter == packet.packetType) { NetClient.instanceClient.packetsSent++; //Debug.Log("Sent Packet: " + packet.packetSendType + ". To: "+serverEndpoint.ToString()); } } #endif }