perf: synchronize network time over unreliable (#2543)

This commit is contained in:
Paul Pacheco 2021-01-14 09:37:25 -06:00 committed by GitHub
parent 1cdbcd64ba
commit 7e3b7b9e11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,7 +58,7 @@ internal static void UpdateClient()
if (Time.time - lastPingTime >= PingFrequency)
{
NetworkPingMessage pingMessage = new NetworkPingMessage(LocalTime());
NetworkClient.Send(pingMessage);
NetworkClient.Send(pingMessage, Channels.DefaultUnreliable);
lastPingTime = Time.time;
}
}
@ -76,7 +76,7 @@ internal static void OnServerPing(NetworkConnection conn, NetworkPingMessage msg
serverTime = LocalTime()
};
conn.Send(pongMsg);
conn.Send(pongMsg, Channels.DefaultUnreliable);
}
// Executed at the client when we receive a Pong message