Skip to content

Commit 15f55dd

Browse files
committed
fix: Fixed virtual or overridden RPC methods
1 parent c5fd679 commit 15f55dd

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

MLAPI/Messaging/RpcTypeDefinition.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,21 @@ private RpcTypeDefinition(Type type)
8080

8181
Dictionary<ulong, ReflectionMethod> lookupTarget = rpcMethod.serverTarget ? serverMethods : clientMethods;
8282

83-
lookupTarget.Add(HashMethodNameAndValidate(method.Name), rpcMethod);
83+
ulong nameHash = HashMethodNameAndValidate(method.Name);
84+
85+
if (!lookupTarget.ContainsKey(nameHash))
86+
{
87+
lookupTarget.Add(nameHash, rpcMethod);
88+
}
8489

8590
if (parameters.Length > 0)
8691
{
87-
lookupTarget.Add(HashMethodNameAndValidate(NetworkedBehaviour.GetHashableMethodSignature(method)), rpcMethod);
92+
ulong signatureHash = HashMethodNameAndValidate(NetworkedBehaviour.GetHashableMethodSignature(method));
93+
94+
if (!lookupTarget.ContainsKey(signatureHash))
95+
{
96+
lookupTarget.Add(signatureHash, rpcMethod);
97+
}
8898
}
8999

90100
if (rpcMethod.useDelegate)

0 commit comments

Comments
 (0)