diff --git a/Mirror/Weaver/Processors/MonoBehaviourProcessor.cs b/Mirror/Weaver/Processors/MonoBehaviourProcessor.cs index 51510f869..3bcb4ad82 100644 --- a/Mirror/Weaver/Processors/MonoBehaviourProcessor.cs +++ b/Mirror/Weaver/Processors/MonoBehaviourProcessor.cs @@ -67,28 +67,27 @@ void ProcessMethods() var attrName = ca.Constructor.DeclaringType.ToString(); - if (attrName == "Mirror.ServerAttribute") + switch (attrName) { - Log.Error("Script " + m_td.FullName + " uses the attribute [Server] on the method " + md.Name + " but is not a NetworkBehaviour."); - Weaver.fail = true; - } - else if (attrName == "Mirror.ServerCallbackAttribute") - { - Log.Error("Script " + m_td.FullName + " uses the attribute [ServerCallback] on the method " + md.Name + " but is not a NetworkBehaviour."); - Weaver.fail = true; - } - else if (attrName == "Mirror.ClientAttribute") - { - Log.Error("Script " + m_td.FullName + " uses the attribute [Client] on the method " + md.Name + " but is not a NetworkBehaviour."); - Weaver.fail = true; - } - else if (attrName == "Mirror.ClientCallbackAttribute") - { - Log.Error("Script " + m_td.FullName + " uses the attribute [ClientCallback] on the method " + md.Name + " but is not a NetworkBehaviour."); - Weaver.fail = true; + case "Mirror.ServerAttribute": + Log.Error("Script " + m_td.FullName + " uses the attribute [Server] on the method " + md.Name + " but is not a NetworkBehaviour."); + Weaver.fail = true; + break; + case "Mirror.ServerCallbackAttribute": + Log.Error("Script " + m_td.FullName + " uses the attribute [ServerCallback] on the method " + md.Name + " but is not a NetworkBehaviour."); + Weaver.fail = true; + break; + case "Mirror.ClientAttribute": + Log.Error("Script " + m_td.FullName + " uses the attribute [Client] on the method " + md.Name + " but is not a NetworkBehaviour."); + Weaver.fail = true; + break; + case "Mirror.ClientCallbackAttribute": + Log.Error("Script " + m_td.FullName + " uses the attribute [ClientCallback] on the method " + md.Name + " but is not a NetworkBehaviour."); + Weaver.fail = true; + break; } } } } } -} +} \ No newline at end of file