mirror of
https://github.com/yasirkula/UnityAssetUsageDetector.git
synced 2026-11-21 07:22:37 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1db9dbf9b0 | |||
| a6b0f5ae92 | |||
| 8e7369e44e |
@@ -51,10 +51,35 @@ namespace AssetUsageDetectorNamespace
|
|||||||
if( fileSizes == null || fileSizes.Length != dependencies.Length )
|
if( fileSizes == null || fileSizes.Length != dependencies.Length )
|
||||||
fileSizes = new long[dependencies.Length];
|
fileSizes = new long[dependencies.Length];
|
||||||
|
|
||||||
for( int i = 0; i < dependencies.Length; i++ )
|
int length = dependencies.Length;
|
||||||
|
for( int i = 0; i < length; i++ )
|
||||||
{
|
{
|
||||||
FileInfo assetFile = new FileInfo( dependencies[i] );
|
if( !string.IsNullOrEmpty( dependencies[i] ) )
|
||||||
fileSizes[i] = assetFile.Exists ? assetFile.Length : 0L;
|
{
|
||||||
|
FileInfo assetFile = new FileInfo( dependencies[i] );
|
||||||
|
fileSizes[i] = assetFile.Exists ? assetFile.Length : 0L;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This dependency is empty which causes issues when passed to FileInfo constructor
|
||||||
|
// Find a non-empty dependency and move it to this index
|
||||||
|
for( int j = length - 1; j > i; j--, length-- )
|
||||||
|
{
|
||||||
|
if( !string.IsNullOrEmpty( dependencies[j] ) )
|
||||||
|
{
|
||||||
|
dependencies[i--] = dependencies[j];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
length--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( length != fileSizes.Length )
|
||||||
|
{
|
||||||
|
Array.Resize( ref dependencies, length );
|
||||||
|
Array.Resize( ref fileSizes, length );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -400,7 +400,11 @@ namespace AssetUsageDetectorNamespace
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ParticleSystem.CollisionModule collisionModule = particleSystem.collision;
|
ParticleSystem.CollisionModule collisionModule = particleSystem.collision;
|
||||||
|
#if UNITY_2020_2_OR_NEWER
|
||||||
|
for( int i = 0, j = collisionModule.planeCount; i < j; i++ )
|
||||||
|
#else
|
||||||
for( int i = 0, j = collisionModule.maxPlaneCount; i < j; i++ )
|
for( int i = 0, j = collisionModule.maxPlaneCount; i < j; i++ )
|
||||||
|
#endif
|
||||||
referenceNode.AddLinkTo( SearchObject( collisionModule.GetPlane( i ) ), "Collision Module: Plane" );
|
referenceNode.AddLinkTo( SearchObject( collisionModule.GetPlane( i ) ), "Collision Module: Plane" );
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
@@ -408,7 +412,11 @@ namespace AssetUsageDetectorNamespace
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ParticleSystem.TriggerModule triggerModule = particleSystem.trigger;
|
ParticleSystem.TriggerModule triggerModule = particleSystem.trigger;
|
||||||
|
#if UNITY_2020_2_OR_NEWER
|
||||||
|
for( int i = 0, j = triggerModule.colliderCount; i < j; i++ )
|
||||||
|
#else
|
||||||
for( int i = 0, j = triggerModule.maxColliderCount; i < j; i++ )
|
for( int i = 0, j = triggerModule.maxColliderCount; i < j; i++ )
|
||||||
|
#endif
|
||||||
referenceNode.AddLinkTo( SearchObject( triggerModule.GetCollider( i ) ), "Trigger Module: Collider" );
|
referenceNode.AddLinkTo( SearchObject( triggerModule.GetCollider( i ) ), "Trigger Module: Collider" );
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
@@ -1021,26 +1029,38 @@ namespace AssetUsageDetectorNamespace
|
|||||||
SerializedProperty iteratorVisible = so.GetIterator();
|
SerializedProperty iteratorVisible = so.GetIterator();
|
||||||
if( iterator.Next( true ) )
|
if( iterator.Next( true ) )
|
||||||
{
|
{
|
||||||
|
string assetPath = AssetDatabase.GetAssetPath( (Object) referenceNode.nodeObject );
|
||||||
|
bool isProjectSettings = !string.IsNullOrEmpty( assetPath ) && assetPath.StartsWithFast( "ProjectSettings/" );
|
||||||
|
|
||||||
bool iteratingVisible = iteratorVisible.NextVisible( true );
|
bool iteratingVisible = iteratorVisible.NextVisible( true );
|
||||||
bool enterChildren;
|
bool enterChildren;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// Iterate over NextVisible properties AND the properties that have corresponding FieldInfos (internal Unity
|
if( isProjectSettings )
|
||||||
// properties don't have FieldInfos so we are skipping them, which is good because search results found in
|
{
|
||||||
// those properties aren't interesting and mostly confusing)
|
// Search Project Settings in full because for some reason, important settings like SRP asset
|
||||||
bool isVisible = iteratingVisible && SerializedProperty.EqualContents( iterator, iteratorVisible );
|
// slot in Quality Settings aren't searched when iterating over only visible properties
|
||||||
if( isVisible )
|
enterChildren = true;
|
||||||
iteratingVisible = iteratorVisible.NextVisible( true );
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Type propFieldType;
|
// Iterate over NextVisible properties AND the properties that have corresponding FieldInfos (internal Unity
|
||||||
isVisible = iterator.type == "Array" || fieldInfoGetter( iterator, out propFieldType ) != null;
|
// properties don't have FieldInfos so we are skipping them, which is good because search results found in
|
||||||
}
|
// those properties aren't interesting and mostly confusing)
|
||||||
|
bool isVisible = iteratingVisible && SerializedProperty.EqualContents( iterator, iteratorVisible );
|
||||||
|
if( isVisible )
|
||||||
|
iteratingVisible = iteratorVisible.NextVisible( true );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Type propFieldType;
|
||||||
|
isVisible = iterator.type == "Array" || fieldInfoGetter( iterator, out propFieldType ) != null;
|
||||||
|
}
|
||||||
|
|
||||||
if( !isVisible )
|
if( !isVisible )
|
||||||
{
|
{
|
||||||
enterChildren = false;
|
enterChildren = false;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReferenceNode searchResult;
|
ReferenceNode searchResult;
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "com.yasirkula.assetusagedetector",
|
"name": "com.yasirkula.assetusagedetector",
|
||||||
"displayName": "Asset Usage Detector",
|
"displayName": "Asset Usage Detector",
|
||||||
"version": "1.9.2",
|
"version": "1.9.5",
|
||||||
"documentationUrl": "https://github.com/yasirkula/UnityAssetUsageDetector",
|
"documentationUrl": "https://github.com/yasirkula/UnityAssetUsageDetector",
|
||||||
"changelogUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/releases",
|
"changelogUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/releases",
|
||||||
"licensesUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/blob/master/LICENSE.txt",
|
"licensesUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/blob/master/LICENSE.txt",
|
||||||
|
|||||||
Reference in New Issue
Block a user