Esempio n. 1
0
    public static IEnumerable <UnityEngine.Object> EnumAllObjectDependentAtPath(string path)
    {
        var           objs     = EnumAssets.EnumObjectAtPath(path);
        List <string> pathList = new List <string>();

        foreach (var obj in objs)
        {
            var assetPath = AssetDatabase.GetAssetPath(obj.GetInstanceID());
            pathList.Add(assetPath);
        }

        var paths = AssetDatabase.GetDependencies(pathList.ToArray());

        foreach (var p in paths)
        {
            var res = AssetDatabase.LoadAssetAtPath(p, typeof(UnityEngine.Object));
            if (null != res)
            {
                yield return(res);
            }
        }
    }