Skip to content

Commit ac55f29

Browse files
committed
Removed a duplicate code
1 parent 8f83162 commit ac55f29

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

Plugins/AssetUsageDetector/Editor/AssetUsageDetectorSearchFunctions.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,10 +1642,6 @@ private VariableGetterHolder[] GetFilteredVariablesForType( Type type )
16421642
if( field.FieldType.IsIgnoredUnityType() )
16431643
continue;
16441644

1645-
// "ref struct"s can't be accessed via reflection
1646-
if( field.FieldType.IsByRefLike )
1647-
continue;
1648-
16491645
// Additional filtering for fields:
16501646
// 1- Ignore "m_RectTransform", "m_CanvasRenderer" and "m_Canvas" fields of Graphic components
16511647
string fieldName = field.Name;
@@ -1668,10 +1664,6 @@ private VariableGetterHolder[] GetFilteredVariablesForType( Type type )
16681664
if( property.PropertyType.IsIgnoredUnityType() )
16691665
continue;
16701666

1671-
// "ref struct"s can't be accessed via reflection
1672-
if( property.PropertyType.IsByRefLike )
1673-
continue;
1674-
16751667
// Skip properties without a getter function
16761668
MethodInfo propertyGetter = property.GetGetMethod( true );
16771669
if( propertyGetter == null )

Plugins/AssetUsageDetector/Editor/Utilities.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,9 @@ public static bool IsIgnoredUnityType( this Type type )
359359
if( typeof( Type ).IsAssignableFrom( type ) || type.Namespace == reflectionNamespace )
360360
return true;
361361

362-
// Searching pointers or ref variables for reference throws ArgumentException
363-
if( type.IsPointer || type.IsByRef )
364-
return true;
362+
// Searching pointers, ref variables or ref structs for reference throws ArgumentException
363+
if (type.IsPointer || type.IsByRef || type.IsByRefLike)
364+
return true;
365365

366366
return false;
367367
}

0 commit comments

Comments
 (0)