mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Changed sendIntervalCounter logic to fix the issue where if sendIntervalMultiplier = 1, NT will send every frame instead of every send interval. This is due to sendIntervalCounter being initialised to 1 instead of 0, after NT has triggered it's send.
This commit is contained in:
parent
8a0accc60b
commit
337a0affee
@ -64,13 +64,20 @@ void LateUpdate()
|
|||||||
|
|
||||||
protected virtual void CheckLastSendTime()
|
protected virtual void CheckLastSendTime()
|
||||||
{
|
{
|
||||||
// timeAsDouble not available in older Unity versions.
|
// We check interval every frame, and then send if interval is reached.
|
||||||
if (AccurateInterval.Elapsed(NetworkTime.localTime, NetworkServer.sendInterval, ref lastSendIntervalTime))
|
// So by the time sendIntervalCounter == sendIntervalMultiplier, data is sent,
|
||||||
{
|
// thus we reset the counter here.
|
||||||
if (sendIntervalCounter == sendIntervalMultiplier)
|
// This fixes previous issue of, if sendIntervalMultiplier = 1, we send every frame,
|
||||||
sendIntervalCounter = 0;
|
// because intervalCounter is always = 1 in the previous version.
|
||||||
sendIntervalCounter++;
|
|
||||||
}
|
if (sendIntervalCounter == sendIntervalMultiplier)
|
||||||
|
sendIntervalCounter = 0;
|
||||||
|
|
||||||
|
// timeAsDouble not available in older Unity versions.
|
||||||
|
if (AccurateInterval.Elapsed(NetworkTime.localTime, NetworkServer.sendInterval, ref lastSendIntervalTime))
|
||||||
|
{
|
||||||
|
sendIntervalCounter++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateServerBroadcast()
|
void UpdateServerBroadcast()
|
||||||
|
Loading…
Reference in New Issue
Block a user