Muted an exception that is raised while searching "ref struct"s for reference

This commit is contained in:
yasirkula
2023-10-07 20:39:31 +03:00
parent 6cd2b407cc
commit efad9fa158
2 changed files with 13 additions and 0 deletions
+1
View File
@@ -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
@@ -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 )