Skip to content

Commit 2b2fb73

Browse files
committed
Update log messages
1 parent e09f83e commit 2b2fb73

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

com.unity.netcode.gameobjects/Runtime/Messaging/Messages/ProxyMessage.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ public unsafe void Handle(ref NetworkContext context)
6060
// Do not handle the message if the sender does not have permission to do so.
6161
if (!hasPermission)
6262
{
63+
if (networkManager.LogLevel <= LogLevel.Developer)
64+
{
65+
NetworkLog.LogErrorServer($"Rpc message received from client-{context.SenderId} who does not have permission to perform this operation!");
66+
}
6367
return;
6468
}
6569

@@ -68,20 +72,20 @@ public unsafe void Handle(ref NetworkContext context)
6872

6973

7074
var nonServerIds = new NativeList<ulong>(Allocator.Temp);
71-
for (var i = 0; i < TargetClientIds.Length; ++i)
75+
foreach (var client in TargetClientIds)
7276
{
73-
if (!observers.Contains(TargetClientIds[i]))
77+
if (!observers.Contains(client))
7478
{
7579
continue;
7680
}
7781

78-
if (TargetClientIds[i] == NetworkManager.ServerClientId)
82+
if (client == NetworkManager.ServerClientId)
7983
{
8084
WrappedMessage.Handle(ref context);
8185
}
8286
else
8387
{
84-
nonServerIds.Add(TargetClientIds[i]);
88+
nonServerIds.Add(client);
8589
}
8690
}
8791

com.unity.netcode.gameobjects/Runtime/Messaging/Messages/RpcMessages.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static void Handle(ref NetworkContext context, ref RpcMetadata metadata,
8080
{
8181
if (networkManager.LogLevel <= LogLevel.Developer)
8282
{
83-
Debug.LogError("Rpc message received from a client who does not have permission to perform this operation!");
83+
NetworkLog.LogErrorServer($"Rpc message received from client-{rpcParams.SenderId} who does not have permission to perform this operation!");
8484
}
8585
return;
8686
}

0 commit comments

Comments
 (0)