Compare commits

..

2 Commits

Author SHA1 Message Date
Süleyman Yasir KULA 3719ce7473 Fixes #13 2019-09-28 12:54:50 +03:00
Süleyman Yasir KULA b4b3e7d7b3 Fixed "Scenes in Build Settings" always being true 2019-09-20 23:09:44 +03:00
3 changed files with 19 additions and 8 deletions
@@ -153,8 +153,10 @@ namespace AssetUsageDetectorNamespace
private int searchedObjectsCount; // Number of searched objects
private double searchStartTime;
private List<ReferenceNode> nodesPool = new List<ReferenceNode>( 32 );
private List<VariableGetterHolder> validVariables = new List<VariableGetterHolder>( 32 );
private readonly List<ReferenceNode> nodesPool = new List<ReferenceNode>( 32 );
private readonly List<VariableGetterHolder> validVariables = new List<VariableGetterHolder>( 32 );
private readonly string reflectionNameSpace = typeof( Assembly ).Namespace;
private string CachePath { get { return Application.dataPath + "/../Library/AssetUsageDetector.cache"; } } // Path of the cache file
@@ -1152,7 +1154,12 @@ namespace AssetUsageDetectorNamespace
continue;
// Skip primitive types
if( fields[i].FieldType.IsPrimitiveUnityType() )
Type variableType = fields[i].FieldType;
if( variableType.IsPrimitiveUnityType() )
continue;
// Searching assembly variables for reference throws InvalidCastException on .NET 4.0 runtime
if( typeof( Type ).IsAssignableFrom( variableType ) || variableType.Namespace == reflectionNameSpace )
continue;
// Additional filtering for fields:
@@ -1184,7 +1191,12 @@ namespace AssetUsageDetectorNamespace
continue;
// Skip primitive types
if( properties[i].PropertyType.IsPrimitiveUnityType() )
Type variableType = properties[i].PropertyType;
if( variableType.IsPrimitiveUnityType() )
continue;
// Searching assembly variables for reference throws InvalidCastException on .NET 4.0 runtime
if( typeof( Type ).IsAssignableFrom( variableType ) || variableType.Namespace == reflectionNameSpace )
continue;
// No need to check properties with 'override' keyword
@@ -321,7 +321,7 @@ namespace AssetUsageDetectorNamespace.Extras
if( !EditorApplication.isPlaying )
{
searchInScenesInBuild = EditorGUILayout.ToggleLeft( "Scenes in Build Settings", true );
searchInScenesInBuild = EditorGUILayout.ToggleLeft( "Scenes in Build Settings", searchInScenesInBuild );
if( searchInScenesInBuild )
{
@@ -16,19 +16,18 @@ namespace AssetUsageDetectorNamespace.Extras
typeof( string ), typeof( Vector4 ), typeof( Vector3 ), typeof( Vector2 ), typeof( Rect ),
typeof( Quaternion ), typeof( Color ), typeof( Color32 ), typeof( LayerMask ),
typeof( Matrix4x4 ), typeof( AnimationCurve ), typeof( Gradient ), typeof( RectOffset ),
typeof( Assembly ), // Searching assembly variables for reference throws InvalidCastException on .NET 4.0 runtime
typeof( bool[] ), typeof( byte[] ), typeof( sbyte[] ), typeof( char[] ), typeof( decimal[] ),
typeof( double[] ), typeof( float[] ), typeof( int[] ), typeof( uint[] ), typeof( long[] ),
typeof( ulong[] ), typeof( short[] ), typeof( ushort[] ), typeof( string[] ),
typeof( Vector4[] ), typeof( Vector3[] ), typeof( Vector2[] ), typeof( Rect[] ),
typeof( Quaternion[] ), typeof( Color[] ), typeof( Color32[] ), typeof( LayerMask[] ),
typeof( Matrix4x4[] ), typeof( AnimationCurve[] ), typeof( Gradient[] ), typeof( RectOffset[] ), typeof( Assembly[] ),
typeof( Matrix4x4[] ), typeof( AnimationCurve[] ), typeof( Gradient[] ), typeof( RectOffset[] ),
typeof( List<bool> ), typeof( List<byte> ), typeof( List<sbyte> ), typeof( List<char> ), typeof( List<decimal> ),
typeof( List<double> ), typeof( List<float> ), typeof( List<int> ), typeof( List<uint> ), typeof( List<long> ),
typeof( List<ulong> ), typeof( List<short> ), typeof( List<ushort> ), typeof( List<string> ),
typeof( List<Vector4> ), typeof( List<Vector3> ), typeof( List<Vector2> ), typeof( List<Rect> ),
typeof( List<Quaternion> ), typeof( List<Color> ), typeof( List<Color32> ), typeof( List<LayerMask> ),
typeof( List<Matrix4x4> ), typeof( List<AnimationCurve> ), typeof( List<Gradient> ), typeof( List<RectOffset> ), typeof( List<Assembly> )
typeof( List<Matrix4x4> ), typeof( List<AnimationCurve> ), typeof( List<Gradient> ), typeof( List<RectOffset> )
};
private static readonly HashSet<string> folderContentsSet = new HashSet<string>();