Skip to content

Commit 486ab1c

Browse files
fix
When using NotMeRpc, make sure we only send to connected clients and not the service to avoid infinite spamming of the RPC.
1 parent e28c904 commit 486ab1c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/NotMeRpcTarget.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ internal override void Send(NetworkBehaviour behaviour, ref RpcMessage message,
4949
{
5050
continue;
5151
}
52-
// In distributed authority mode, we send to target id 0 (which would be a DAHost) via the group
53-
if (clientId == NetworkManager.ServerClientId && !m_NetworkManager.DistributedAuthorityMode)
52+
// In distributed authority mode, we send to target id 0 (which would be a DAHost).
53+
// We only add when there is a "DAHost" by
54+
// - excluding the server id when using client-server (i.e. !m_NetworkManager.DistributedAuthorityMode )
55+
// - excluding if connected to the CMB backend service (i.e. we don't want to send to service as it will broadcast it back)
56+
if (clientId == NetworkManager.ServerClientId && (!m_NetworkManager.DistributedAuthorityMode || m_NetworkManager.CMBServiceConnection))
5457
{
5558
continue;
5659
}

0 commit comments

Comments
 (0)