FishNet icon indicating copy to clipboard operation
FishNet copied to clipboard

Methods with multiple RPC attributes are counting as only 1 RPC.

Open FirstGearGames opened this issue 1 year ago • 0 comments

FishNet 4.3.0.

Methods with multiple RPC attributes on a single method and using inheritance will result an a runtime error. 'Rpc Type' key # has already been added for YourClass on GameObject

Resolution is to find Method internal uint GetRpcCount(TypeDefinition typeDef) within RpcProcessor and replace it's entirety with this.

        internal uint GetRpcCount(TypeDefinition typeDef)
        {
            uint count = 0;
            foreach (MethodDefinition methodDef in typeDef.Methods)
            {
                foreach (CustomAttribute customAttribute in methodDef.CustomAttributes)
                {
                    RpcType rpcType = base.GetClass<AttributeHelper>().GetRpcAttributeType(customAttribute);
                    if (rpcType != RpcType.None)
                        count++;
                        break;
                }
            }

            return count;
        }

Resolved in 4.3.1

FirstGearGames avatar May 11 '24 22:05 FirstGearGames