Skip to content

Commit 1aa5a33

Browse files
committed
fix: Don't flood WebGL with errors for unreliable EntityStateMessages
- Fixed copy-pasted incorrect comments too
1 parent 6582994 commit 1aa5a33

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Assets/Mirror/Core/NetworkClient.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using Mirror.RemoteCalls;
@@ -1509,8 +1509,9 @@ static void OnEntityStateMessageUnreliableBaseline(EntityStateMessageUnreliableB
15091509

15101510
static void OnEntityStateMessageUnreliableDelta(EntityStateMessageUnreliableDelta message, int channelId)
15111511
{
1512-
// safety check: baseline should always arrive over Reliable channel.
1513-
if (channelId != Channels.Unreliable)
1512+
// safety check: deltas should always arrive over Unreliable channel.
1513+
// WebGL forces all messages to Reliable, so don't flood errors or break for that platform.
1514+
if (!Utils.IsWebGL && channelId != Channels.Unreliable)
15141515
{
15151516
Debug.LogError($"Client OnEntityStateMessageUnreliableDelta arrived on channel {channelId} instead of Unreliable. This should never happen!");
15161517
return;

Assets/Mirror/Core/NetworkServer.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,9 @@ static void OnEntityStateMessageUnreliableBaseline(NetworkConnectionToClient con
511511
// for client's owned ClientToServer components.
512512
static void OnEntityStateMessageUnreliableDelta(NetworkConnectionToClient connection, EntityStateMessageUnreliableDelta message, int channelId)
513513
{
514-
// safety check: baseline should always arrive over Reliable channel.
515-
if (channelId != Channels.Unreliable)
514+
// safety check: deltas should always arrive over Unreliable channel.
515+
// WebGL forces all messages to Reliable, so don't flood errors or break for that platform.
516+
if (!Utils.IsWebGL && channelId != Channels.Unreliable)
516517
{
517518
Debug.LogError($"Server OnEntityStateMessageUnreliableDelta arrived on channel {channelId} instead of Unreliable. This should never happen!");
518519
return;

0 commit comments

Comments
 (0)