2025-10-23 12:48:45 +08:00
|
|
|
|
using System.Collections.Generic;
|
2025-10-22 10:20:34 +08:00
|
|
|
|
namespace UnityFileApi
|
|
|
|
|
|
{
|
|
|
|
|
|
public static class DependencyTool
|
|
|
|
|
|
{
|
|
|
|
|
|
static DependencyTool()
|
|
|
|
|
|
{
|
|
|
|
|
|
UnityFileSystem.Init();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static List<string> GetDependencies(string path)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<string> dependencies = new List<string>();
|
|
|
|
|
|
|
2025-10-23 12:48:45 +08:00
|
|
|
|
// Try as SerializedFile
|
|
|
|
|
|
using (var serializedFile = UnityFileSystem.OpenSerializedFile(path))
|
2025-10-22 10:20:34 +08:00
|
|
|
|
{
|
2025-10-23 12:48:45 +08:00
|
|
|
|
foreach (var extRef in serializedFile.ExternalReferences)
|
2025-10-22 10:20:34 +08:00
|
|
|
|
{
|
2025-10-23 12:48:45 +08:00
|
|
|
|
dependencies.Add(extRef.Guid);
|
2025-10-22 10:20:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-10-23 12:48:45 +08:00
|
|
|
|
|
|
|
|
|
|
return dependencies;
|
2025-10-22 10:20:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|