diff --git a/Assets/Mirror/Editor/Weaver/Extensions.cs b/Assets/Mirror/Editor/Weaver/Extensions.cs index 65438f8e5..365a028ba 100644 --- a/Assets/Mirror/Editor/Weaver/Extensions.cs +++ b/Assets/Mirror/Editor/Weaver/Extensions.cs @@ -179,12 +179,8 @@ public static CustomAttribute GetCustomAttribute(this ICustomAttributeProvider m public static bool HasCustomAttribute(this ICustomAttributeProvider attributeProvider, TypeReference attribute) { - foreach (CustomAttribute ca in attributeProvider.CustomAttributes) - { - if (ca.AttributeType.FullName == attribute.FullName) - return true; - } - return false; + // Linq allocations don't matter in weaver + return attributeProvider.CustomAttributes.Any(attr => attr.AttributeType.FullName == attribute.FullName); } public static T GetField(this CustomAttribute ca, string field, T defaultValue)