mirror of
https://github.com/yasirkula/UnityAssetUsageDetector.git
synced 2026-11-19 22:42:37 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c4292159a | |||
| 1a2eba24bd | |||
| cf0fea56ab | |||
| 956aea1ced |
+1
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
**Discord:** https://discord.gg/UJJt549AaV
|
||||
|
||||
**[Support the Developer ☕](https://yasirkula.itch.io/unity3d)**
|
||||
**[GitHub Sponsors ☕](https://github.com/sponsors/yasirkula)**
|
||||
|
||||
## ABOUT
|
||||
|
||||
|
||||
@@ -289,10 +289,10 @@ namespace AssetUsageDetectorNamespace
|
||||
if( ( searchParameters.searchInScenes & SceneSearchMode.OpenScenes ) == SceneSearchMode.OpenScenes )
|
||||
{
|
||||
// Get all open (and loaded) scenes
|
||||
for( int i = 0; i < EditorSceneManager.loadedSceneCount; i++ )
|
||||
for( int i = 0; i < SceneManager.sceneCount; i++ )
|
||||
{
|
||||
Scene scene = EditorSceneManager.GetSceneAt( i );
|
||||
if( scene.IsValid() )
|
||||
Scene scene = SceneManager.GetSceneAt( i );
|
||||
if( scene.IsValid() && scene.isLoaded )
|
||||
scenesToSearch.Add( scene.path );
|
||||
}
|
||||
}
|
||||
@@ -314,10 +314,10 @@ namespace AssetUsageDetectorNamespace
|
||||
if( isInPlayMode )
|
||||
{
|
||||
HashSet<string> openScenes = new HashSet<string>();
|
||||
for( int i = 0; i < EditorSceneManager.loadedSceneCount; i++ )
|
||||
for( int i = 0; i < SceneManager.sceneCount; i++ )
|
||||
{
|
||||
Scene scene = EditorSceneManager.GetSceneAt( i );
|
||||
if( scene.IsValid() )
|
||||
Scene scene = SceneManager.GetSceneAt( i );
|
||||
if( scene.IsValid() && scene.isLoaded )
|
||||
openScenes.Add( scene.path );
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,13 @@ namespace AssetUsageDetectorNamespace
|
||||
#endregion
|
||||
|
||||
#region Other Settings
|
||||
private static bool? m_showRootAssetName = null;
|
||||
public static bool ShowRootAssetName
|
||||
{
|
||||
get { if( m_showRootAssetName == null ) m_showRootAssetName = EditorPrefs.GetBool( "AUD_ShowRootAssetName", false ); return m_showRootAssetName.Value; }
|
||||
set { if( m_showRootAssetName == value ) return; m_showRootAssetName = value; EditorPrefs.SetBool( "AUD_ShowRootAssetName", value ); }
|
||||
}
|
||||
|
||||
private static bool? m_pingClickedObjects = null;
|
||||
public static bool PingClickedObjects
|
||||
{
|
||||
@@ -179,7 +186,9 @@ namespace AssetUsageDetectorNamespace
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
SettingsHeaderColor = ColorField( "Settings Header Color", SettingsHeaderColor, Color.cyan );
|
||||
EditorGUIUtility.labelWidth += 140f;
|
||||
ShowRootAssetName = EditorGUILayout.Toggle( "Show Root Asset's Name For Sub-Assets (Requires Refresh)", ShowRootAssetName );
|
||||
EditorGUIUtility.labelWidth -= 140f;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
@@ -202,6 +211,7 @@ namespace AssetUsageDetectorNamespace
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
SettingsHeaderColor = ColorField( "Settings Header Color", SettingsHeaderColor, Color.cyan );
|
||||
SearchResultGroupHeaderColor = ColorField( "Group Header Color", SearchResultGroupHeaderColor, Color.cyan );
|
||||
RootRowsBackgroundColor = ColorField( "Root Rows Background Color", RootRowsBackgroundColor, EditorGUIUtility.isProSkin ? new Color( 0f, 1f, 1f, 0.15f ) : new Color( 0f, 1f, 1f, 0.25f ) );
|
||||
RootRowsBorderColor = ColorField( "Root Rows Border Color", RootRowsBorderColor, EditorGUIUtility.isProSkin ? new Color( 0.15f, 0.15f, 0.15f, 1f ) : new Color( 0.375f, 0.375f, 0.375f, 1f ) );
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
@@ -802,7 +803,12 @@ namespace AssetUsageDetectorNamespace
|
||||
}
|
||||
}
|
||||
|
||||
if( Type == GroupType.Scene && !EditorApplication.isPlaying && EditorSceneManager.loadedSceneCount > 1 )
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
int loadedSceneCount = SceneManager.loadedSceneCount;
|
||||
#else
|
||||
int loadedSceneCount = EditorSceneManager.loadedSceneCount;
|
||||
#endif
|
||||
if( Type == GroupType.Scene && !EditorApplication.isPlaying && loadedSceneCount > 1 )
|
||||
{
|
||||
// Show context menu when SearchResultGroup's header is right clicked
|
||||
Scene scene = EditorSceneManager.GetSceneByPath( ScenePath );
|
||||
@@ -1221,6 +1227,13 @@ namespace AssetUsageDetectorNamespace
|
||||
{
|
||||
instanceId = unityObject.GetInstanceID();
|
||||
Label = unityObject.name + " (" + unityObject.GetType().Name + ")";
|
||||
|
||||
if( AssetUsageDetectorSettings.ShowRootAssetName && unityObject.IsAsset() && !AssetDatabase.IsMainAsset( unityObject ) )
|
||||
{
|
||||
string mainAssetName = Path.GetFileNameWithoutExtension( AssetDatabase.GetAssetPath( unityObject ) );
|
||||
if( unityObject.name != mainAssetName )
|
||||
Label += " <" + mainAssetName + ">";
|
||||
}
|
||||
}
|
||||
else if( nodeObject != null )
|
||||
{
|
||||
|
||||
@@ -177,6 +177,12 @@ namespace AssetUsageDetectorNamespace
|
||||
selection = objTR.gameObject;
|
||||
#endif
|
||||
}
|
||||
else if( prefabAssetType == PrefabAssetType.Model )
|
||||
{
|
||||
objTR = ( (GameObject) obj ).transform;
|
||||
while( objTR.parent != null && objTR.parent.parent != null )
|
||||
objTR = objTR.parent;
|
||||
}
|
||||
#else
|
||||
Transform objTR = ( (GameObject) obj ).transform;
|
||||
while( objTR.parent != null && objTR.parent.parent != null )
|
||||
@@ -410,9 +416,9 @@ namespace AssetUsageDetectorNamespace
|
||||
// Check if all open scenes are saved (not dirty)
|
||||
public static bool AreScenesSaved()
|
||||
{
|
||||
for( int i = 0; i < EditorSceneManager.loadedSceneCount; i++ )
|
||||
for( int i = 0; i < SceneManager.sceneCount; i++ )
|
||||
{
|
||||
Scene scene = EditorSceneManager.GetSceneAt( i );
|
||||
Scene scene = SceneManager.GetSceneAt( i );
|
||||
if( scene.isDirty || string.IsNullOrEmpty( scene.path ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
= Asset Usage Detector (v2.4.0) =
|
||||
= Asset Usage Detector (v2.4.2) =
|
||||
|
||||
Online documentation available at: https://github.com/yasirkula/UnityAssetUsageDetector
|
||||
E-mail: yasirkula@gmail.com
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "com.yasirkula.assetusagedetector",
|
||||
"displayName": "Asset Usage Detector",
|
||||
"version": "2.4.0",
|
||||
"version": "2.4.2",
|
||||
"documentationUrl": "https://github.com/yasirkula/UnityAssetUsageDetector",
|
||||
"changelogUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/releases",
|
||||
"licensesUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/blob/master/LICENSE.txt",
|
||||
|
||||
Reference in New Issue
Block a user