Fix using RPC attribute without ctor usage
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user