|
@@ -22,13 +22,23 @@ namespace IntelligentProjectAnalyzer.Editor
|
|
|
/// Finds all relevant asset GUIDs for scripts, prefabs, and ScriptableObjects.
|
|
|
/// </summary>
|
|
|
/// <returns>A tuple containing queues of GUIDs for each asset type.</returns>
|
|
|
- public static (Queue<string> scriptGuids, Queue<string> prefabGuids, Queue<string> soGuids, Queue<string> sceneGuids) FindAssetGuids()
|
|
|
+ public static (Queue<string> scriptGuids, Queue<string> prefabGuids, Queue<string> soGuids, Queue<string> sceneGuids, Queue<string> miscGuids) FindAssetGuids()
|
|
|
{
|
|
|
var scripts = new Queue<string>(AssetDatabase.FindAssets("t:MonoScript"));
|
|
|
var prefabs = new Queue<string>(AssetDatabase.FindAssets("t:Prefab"));
|
|
|
var scriptableObjects = new Queue<string>(AssetDatabase.FindAssets("t:ScriptableObject"));
|
|
|
var scenes = new Queue<string>(AssetDatabase.FindAssets("t:Scene"));
|
|
|
- return (scripts, prefabs, scriptableObjects, scenes);
|
|
|
+ var allGuids = new Queue<string>(AssetDatabase.FindAssets(""));
|
|
|
+
|
|
|
+ var knownGuids = new HashSet<string>();
|
|
|
+ knownGuids.UnionWith(scriptableObjects);
|
|
|
+ knownGuids.UnionWith(prefabs);
|
|
|
+ knownGuids.UnionWith(scriptableObjects);
|
|
|
+ knownGuids.UnionWith(scenes);
|
|
|
+
|
|
|
+ var miscGuids = new Queue<string>(allGuids.Except(knownGuids));
|
|
|
+
|
|
|
+ return (scripts, prefabs, scriptableObjects, scenes, miscGuids);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -176,6 +186,31 @@ namespace IntelligentProjectAnalyzer.Editor
|
|
|
return setupData;
|
|
|
}
|
|
|
|
|
|
+ public static MiscAssetMetadata PreFetchMiscAssetMetadata(string guid)
|
|
|
+ {
|
|
|
+ var assetPath = AssetDatabase.GUIDToAssetPath(guid);
|
|
|
+ if (string.IsNullOrEmpty(assetPath) || !assetPath.StartsWith("Assets/")) return null;
|
|
|
+
|
|
|
+ var miscMetaData = new MiscAssetMetadata() { Guid = guid };
|
|
|
+ var hash = new HashSet<string>();
|
|
|
+
|
|
|
+ var assetDependencies = AssetDatabase.GetDependencies(assetPath);
|
|
|
+ foreach (var dependency in assetDependencies)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dependency) || !dependency.StartsWith("Assets/") || dependency == assetPath)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ var dependencyGuid = AssetDatabase.AssetPathToGUID(dependency);
|
|
|
+ if (!string.IsNullOrEmpty(dependencyGuid))
|
|
|
+ {
|
|
|
+ hash.Add(dependencyGuid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ miscMetaData.DependencyGuids = hash.ToList();
|
|
|
+ return miscMetaData;
|
|
|
+ }
|
|
|
+
|
|
|
public static SceneMetadata PreFetchSceneMetadata(string guid)
|
|
|
{
|
|
|
var assetPath = AssetDatabase.GUIDToAssetPath(guid);
|
|
@@ -186,7 +221,7 @@ namespace IntelligentProjectAnalyzer.Editor
|
|
|
var sceneMetaData = new SceneMetadata() { Guid = guid };
|
|
|
var hash = new HashSet<string>();
|
|
|
|
|
|
- // Find all components on the prefab and its children to get their script GUIDs.
|
|
|
+ // Find all components on the scene and its children to get their script GUIDs.
|
|
|
foreach (var root in scene.GetRootGameObjects())
|
|
|
{
|
|
|
var components = root.GetComponentsInChildren<Component>(true);
|