fix: Add missing channelId to NetworkConnectionToClient.Send calls (#1509)

* fix: Add missing channelId to NetworkConnectionToClient.Send calls

* Updated ChangeLog

* Added braces

* Found one more
This commit is contained in:
MrGadget 2020-02-20 03:51:03 -05:00 committed by GitHub
parent bf47ae4cf1
commit b8bcd9ad25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -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));
@ -246,7 +246,10 @@ static bool SendToObservers<T>(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>(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<T>(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
/// <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
{

View File

@ -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.