From 07ca64c8a064c889b51e051455c1f7576aef53ab Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 10 Feb 2023 11:02:06 +0100 Subject: [PATCH] Fix using RPC attribute without ctor usage --- Source/Tools/Flax.Build/Build/Plugins/NetworkingPlugin.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/Tools/Flax.Build/Build/Plugins/NetworkingPlugin.cs b/Source/Tools/Flax.Build/Build/Plugins/NetworkingPlugin.cs index 63c9bacfa..ec23852d8 100644 --- a/Source/Tools/Flax.Build/Build/Plugins/NetworkingPlugin.cs +++ b/Source/Tools/Flax.Build/Build/Plugins/NetworkingPlugin.cs @@ -1244,15 +1244,16 @@ namespace Flax.Build.Plugins var methodRPC = new MethodRPC(); methodRPC.Type = type; methodRPC.Method = method; - methodRPC.IsServer = (bool)attribute.GetFieldValue("Server", false); - methodRPC.IsClient = (bool)attribute.GetFieldValue("Client", false); - methodRPC.Channel = (int)attribute.GetFieldValue("Channel", 4); // int as NetworkChannelType (default is ReliableOrdered=4) + methodRPC.Channel = 4; // int as NetworkChannelType (default is ReliableOrdered=4) if (attribute.HasConstructorArguments && attribute.ConstructorArguments.Count >= 3) { methodRPC.IsServer = (bool)attribute.ConstructorArguments[0].Value; methodRPC.IsClient = (bool)attribute.ConstructorArguments[1].Value; methodRPC.Channel = (int)attribute.ConstructorArguments[2].Value; } + methodRPC.IsServer = (bool)attribute.GetFieldValue("Server", methodRPC.IsServer); + methodRPC.IsClient = (bool)attribute.GetFieldValue("Client", methodRPC.IsClient); + methodRPC.Channel = (int)attribute.GetFieldValue("Channel", methodRPC.Channel); if (methodRPC.IsServer && methodRPC.IsClient) { MonoCecil.CompilationError($"Network RPC {method.Name} in {type.FullName} cannot be both Server and Client.", method);