diff --git a/.github/README.md b/.github/README.md index 27105b2..72d7948 100644 --- a/.github/README.md +++ b/.github/README.md @@ -68,5 +68,6 @@ void ReplaceFontUsages( Font from, Font to ) - *static* variables aren't searched - *Resources.Load* usages can't be found +- *ref struct*s can't be searched - *GUIText* materials aren't searched - Textures in *Lens Flares* can't be searched diff --git a/Plugins/AssetUsageDetector/Editor/AssetUsageDetectorSearchFunctions.cs b/Plugins/AssetUsageDetector/Editor/AssetUsageDetectorSearchFunctions.cs index d62f0cc..8f23ac2 100644 --- a/Plugins/AssetUsageDetector/Editor/AssetUsageDetectorSearchFunctions.cs +++ b/Plugins/AssetUsageDetector/Editor/AssetUsageDetectorSearchFunctions.cs @@ -1677,6 +1677,12 @@ namespace AssetUsageDetectorNamespace if( field.FieldType.IsIgnoredUnityType() ) continue; +#if UNITY_2021_2_OR_NEWER + // "ref struct"s can't be accessed via reflection + if( field.FieldType.IsByRefLike ) + continue; +#endif + // Additional filtering for fields: // 1- Ignore "m_RectTransform", "m_CanvasRenderer" and "m_Canvas" fields of Graphic components string fieldName = field.Name; @@ -1711,6 +1717,12 @@ namespace AssetUsageDetectorNamespace if( property.PropertyType.IsIgnoredUnityType() ) continue; +#if UNITY_2021_2_OR_NEWER + // "ref struct"s can't be accessed via reflection + if( property.PropertyType.IsByRefLike ) + continue; +#endif + // Skip properties without a getter function MethodInfo propertyGetter = property.GetGetMethod( true ); if( propertyGetter == null )