diff --git a/Assets/Mirror/Runtime/NetworkServer.cs b/Assets/Mirror/Runtime/NetworkServer.cs index f13c7afdc..cb08baf86 100644 --- a/Assets/Mirror/Runtime/NetworkServer.cs +++ b/Assets/Mirror/Runtime/NetworkServer.cs @@ -216,7 +216,7 @@ internal static void ActivateLocalClientScene() // this is like SendToReady - but it doesn't check the ready flag on the connection. // this is used for ObjectDestroy messages. - static bool SendToObservers(NetworkIdentity identity, T msg) where T : IMessageBase + static bool SendToObservers(NetworkIdentity identity, T msg, int channelId = Channels.DefaultReliable) where T : IMessageBase { if (LogFilter.Debug) Debug.Log("Server.SendToObservers id:" + typeof(T)); @@ -246,7 +246,10 @@ static bool SendToObservers(NetworkIdentity identity, T msg) where T : IMessa // send to all internet connections at once if (connectionIdsCache.Count > 0) - result &= NetworkConnectionToClient.Send(connectionIdsCache, segment); + { + result &= NetworkConnectionToClient.Send(connectionIdsCache, segment, channelId); + } + NetworkDiagnostics.OnSend(msg, Channels.DefaultReliable, segment.Count, identity.observers.Count); return result; @@ -312,7 +315,10 @@ public static bool SendToAll(T msg, int channelId = Channels.DefaultReliable) // send to all internet connections at once if (connectionIdsCache.Count > 0) - result &= NetworkConnectionToClient.Send(connectionIdsCache, segment); + { + result &= NetworkConnectionToClient.Send(connectionIdsCache, segment, channelId); + } + NetworkDiagnostics.OnSend(msg, channelId, segment.Count, connections.Count); return result; @@ -394,7 +400,10 @@ public static bool SendToReady(NetworkIdentity identity, T msg, bool includeO // send to all internet connections at once if (connectionIdsCache.Count > 0) - result &= NetworkConnectionToClient.Send(connectionIdsCache, segment); + { + result &= NetworkConnectionToClient.Send(connectionIdsCache, segment, channelId); + } + NetworkDiagnostics.OnSend(msg, channelId, segment.Count, count); return result; @@ -698,11 +707,11 @@ public static void SendToClientOfPlayer(NetworkIdentity identity, int msgType, M /// Message type /// /// - public static void SendToClientOfPlayer(NetworkIdentity identity, T msg) where T : IMessageBase + public static void SendToClientOfPlayer(NetworkIdentity identity, T msg, int channelId = Channels.DefaultReliable) where T : IMessageBase { if (identity != null) { - identity.connectionToClient.Send(msg); + identity.connectionToClient.Send(msg, channelId); } else { diff --git a/doc/General/ChangeLog.md b/doc/General/ChangeLog.md index fb2f20294..3b689ebe5 100644 --- a/doc/General/ChangeLog.md +++ b/doc/General/ChangeLog.md @@ -15,6 +15,7 @@ Mirror uses semantic versioning, and the versions shown here are those that were - Fixed: Host Player race condition for Ready message. - Fixed: NetworkAnimator and NetworkTransform now correctly check for client authority in their respective Command methods. - Fixed: Network Room Manager Script Template had a virtual method instead of an override. +- Fixed: NetworkServer's calls to NetworkConnectionToClient.Send now includes the channelId parameter that was missing. - Changed: NetworkSceneChecker now works from OnEnable instead of Awake, and uses Scene instead of scene name. - Changed: Renamed NeworkWriter.Write to WriteMessage for consistency.