Compare commits

..

4 Commits

5 changed files with 14 additions and 17 deletions
@@ -192,10 +192,10 @@ namespace AssetUsageDetectorNamespace
#endif
#if ASSET_USAGE_VFX_GRAPH
private static Type vfxResourceType => typeof( Editor ).Assembly.GetType( "UnityEditor.VFX.VisualEffectResource" ) ?? Array.Find( AppDomain.CurrentDomain.GetAssemblies(), ( assembly ) => assembly.GetName().Name == "UnityEditor.VFXModule" ).GetType( "UnityEditor.VFX.VisualEffectResource" );
private static Type vfxResourceType => Type.GetType("UnityEditor.VFX.VisualEffectResource, UnityEditor.VFXModule") ?? typeof(Editor).Assembly.GetType("UnityEditor.VFX.VisualEffectResource");
private readonly Func<string, object> vfxResourceGetter = (Func<string, object>) Delegate.CreateDelegate( typeof( Func<string, object> ), vfxResourceType.GetMethod( "GetResourceAtPath", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static ) );
private readonly MethodInfo vfxResourceContentsGetter = vfxResourceType.GetMethod( "GetContents", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance );
private readonly MethodInfo vfxSerializableObjectValueGetter = Array.Find( Array.Find( AppDomain.CurrentDomain.GetAssemblies(), ( assembly ) => assembly.GetName().Name == "Unity.VisualEffectGraph.Editor" ).GetType( "UnityEditor.VFX.VFXSerializableObject" ).GetMethods( BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance ), ( methodInfo ) => methodInfo.Name == "Get" && !methodInfo.IsGenericMethod );
private readonly MethodInfo vfxSerializableObjectValueGetter = Array.Find(Type.GetType("UnityEditor.VFX.VFXSerializableObject, Unity.VisualEffectGraph.Editor").GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance), (methodInfo) => methodInfo.Name == "Get" && !methodInfo.IsGenericMethod);
#endif
private void InitializeSearchFunctionsData( Parameters searchParameters )
@@ -1642,10 +1642,6 @@ namespace AssetUsageDetectorNamespace
if( field.FieldType.IsIgnoredUnityType() )
continue;
// "ref struct"s can't be accessed via reflection
if( field.FieldType.IsByRefLike )
continue;
// Additional filtering for fields:
// 1- Ignore "m_RectTransform", "m_CanvasRenderer" and "m_Canvas" fields of Graphic components
string fieldName = field.Name;
@@ -1668,10 +1664,6 @@ namespace AssetUsageDetectorNamespace
if( property.PropertyType.IsIgnoredUnityType() )
continue;
// "ref struct"s can't be accessed via reflection
if( property.PropertyType.IsByRefLike )
continue;
// Skip properties without a getter function
MethodInfo propertyGetter = property.GetGetMethod( true );
if( propertyGetter == null )
@@ -1368,7 +1368,7 @@ namespace AssetUsageDetectorNamespace
{
label = Label,
isMainReference = IsMainReference,
instanceId = instanceId ?? 0,
instanceId = instanceId ?? default,
isUnityObject = instanceId.HasValue,
usedState = usedState
};
@@ -1418,4 +1418,4 @@ namespace AssetUsageDetectorNamespace
return uid;
}
}
}
}
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Unity.Collections;
using UnityEditor;
using UnityEditor.SceneManagement;
@@ -359,9 +360,13 @@ namespace AssetUsageDetectorNamespace
if( typeof( Type ).IsAssignableFrom( type ) || type.Namespace == reflectionNamespace )
return true;
// Searching pointers or ref variables for reference throws ArgumentException
if( type.IsPointer || type.IsByRef )
return true;
// Searching Tasks for reference may freeze Unity since Task.Result freezes the active thread if Task hasn't completed yet
if (typeof(Task).IsAssignableFrom(type))
return true;
// Searching pointers, ref variables or ref structs for reference throws ArgumentException
if (type.IsPointer || type.IsByRef || type.IsByRefLike)
return true;
return false;
}
+1 -1
View File
@@ -1,4 +1,4 @@
= Asset Usage Detector (v2.6.0) =
= Asset Usage Detector (v2.6.2) =
Documentation: https://github.com/yasirkula/UnityAssetUsageDetector
E-mail: yasirkula@gmail.com
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "com.yasirkula.assetusagedetector",
"displayName": "Asset Usage Detector",
"version": "2.6.0",
"version": "2.6.2",
"documentationUrl": "https://github.com/yasirkula/UnityAssetUsageDetector",
"changelogUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/releases",
"licensesUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/blob/master/LICENSE.txt",