Skip to content

Commit efad9fa

Browse files
committed
Muted an exception that is raised while searching "ref struct"s for reference
1 parent 6cd2b40 commit efad9fa

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

.github/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,6 @@ void ReplaceFontUsages( Font from, Font to )
6868

6969
- *static* variables aren't searched
7070
- *Resources.Load* usages can't be found
71+
- *ref struct*s can't be searched
7172
- *GUIText* materials aren't searched
7273
- Textures in *Lens Flares* can't be searched

Plugins/AssetUsageDetector/Editor/AssetUsageDetectorSearchFunctions.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,6 +1677,12 @@ private VariableGetterHolder[] GetFilteredVariablesForType( Type type )
16771677
if( field.FieldType.IsIgnoredUnityType() )
16781678
continue;
16791679

1680+
#if UNITY_2021_2_OR_NEWER
1681+
// "ref struct"s can't be accessed via reflection
1682+
if( field.FieldType.IsByRefLike )
1683+
continue;
1684+
#endif
1685+
16801686
// Additional filtering for fields:
16811687
// 1- Ignore "m_RectTransform", "m_CanvasRenderer" and "m_Canvas" fields of Graphic components
16821688
string fieldName = field.Name;
@@ -1711,6 +1717,12 @@ private VariableGetterHolder[] GetFilteredVariablesForType( Type type )
17111717
if( property.PropertyType.IsIgnoredUnityType() )
17121718
continue;
17131719

1720+
#if UNITY_2021_2_OR_NEWER
1721+
// "ref struct"s can't be accessed via reflection
1722+
if( property.PropertyType.IsByRefLike )
1723+
continue;
1724+
#endif
1725+
17141726
// Skip properties without a getter function
17151727
MethodInfo propertyGetter = property.GetGetMethod( true );
17161728
if( propertyGetter == null )

0 commit comments

Comments
 (0)