diff --git a/Assets/Mirror/Editor/Weaver/Processors/MonoBehaviourProcessor.cs b/Assets/Mirror/Editor/Weaver/Processors/MonoBehaviourProcessor.cs index 853c85e3b..5f2448728 100644 --- a/Assets/Mirror/Editor/Weaver/Processors/MonoBehaviourProcessor.cs +++ b/Assets/Mirror/Editor/Weaver/Processors/MonoBehaviourProcessor.cs @@ -33,23 +33,12 @@ static void ProcessMethods(TypeDefinition td) // find command and RPC functions foreach (MethodDefinition md in td.Methods) { - foreach (CustomAttribute ca in md.CustomAttributes) - { - if (ca.AttributeType.Is()) - { - Weaver.Error($"Command {md.Name} must be declared inside a NetworkBehaviour", md); - } - - if (ca.AttributeType.Is()) - { - Weaver.Error($"ClientRpc {md.Name} must be declared inside a NetworkBehaviour", md); - } - - if (ca.AttributeType.Is()) - { - Weaver.Error($"TargetRpc {md.Name} must be declared inside a NetworkBehaviour", md); - } - } + if (md.HasCustomAttribute()) + Weaver.Error($"Command {md.Name} must be declared inside a NetworkBehaviour", md); + if (md.HasCustomAttribute()) + Weaver.Error($"ClientRpc {md.Name} must be declared inside a NetworkBehaviour", md); + if (md.HasCustomAttribute()) + Weaver.Error($"TargetRpc {md.Name} must be declared inside a NetworkBehaviour", md); } } }