Skip to content

Commit

Permalink
fix: Add missing channelId to NetworkConnectionToClient.Send calls (#…
Browse files Browse the repository at this point in the history
…1509)

* fix: Add missing channelId to NetworkConnectionToClient.Send calls

* Updated ChangeLog

* Added braces

* Found one more
  • Loading branch information
MrGadget committed Feb 20, 2020
1 parent bf47ae4 commit b8bcd9a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
21 changes: 15 additions & 6 deletions Assets/Mirror/Runtime/NetworkServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(NetworkIdentity identity, T msg) where T : IMessageBase
static bool SendToObservers<T>(NetworkIdentity identity, T msg, int channelId = Channels.DefaultReliable) where T : IMessageBase
{
if (LogFilter.Debug) Debug.Log("Server.SendToObservers id:" + typeof(T));

Expand Down Expand Up @@ -246,7 +246,10 @@ internal static void ActivateLocalClientScene()

// 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;
Expand Down Expand Up @@ -312,7 +315,10 @@ public static bool SendToAll(int msgType, MessageBase msg, int channelId = Chann

// 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;
Expand Down Expand Up @@ -394,7 +400,10 @@ public static bool SendToReady(NetworkIdentity identity, short msgType, MessageB

// 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;
Expand Down Expand Up @@ -698,11 +707,11 @@ public static void SendToClientOfPlayer(NetworkIdentity identity, int msgType, M
/// <typeparam name="T">Message type</typeparam>
/// <param name="identity"></param>
/// <param name="msg"></param>
public static void SendToClientOfPlayer<T>(NetworkIdentity identity, T msg) where T : IMessageBase
public static void SendToClientOfPlayer<T>(NetworkIdentity identity, T msg, int channelId = Channels.DefaultReliable) where T : IMessageBase
{
if (identity != null)
{
identity.connectionToClient.Send(msg);
identity.connectionToClient.Send(msg, channelId);
}
else
{
Expand Down
1 change: 1 addition & 0 deletions doc/General/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit b8bcd9a

Please sign in to comment.