コード例 #1
0
ファイル: U3DAssetDB.cs プロジェクト: Hengle/UnityEditor
    private void _UpdateAssetTableStep()
    {
        string path = iter.Current as string;

        if (_IsIgnoreAsset(path))
        {
            return;
        }

        U3DAssetInfo assetInfo = new U3DAssetInfo();

        ResourceManageToolUtility.InitAssetInfo(path, ref assetInfo);
        Guid guid = assetInfo.guid;


        string[] deps = ResourceManageToolUtility.GetDependencies(path);
        foreach (var depPath in deps)
        {
            Guid depGuid = ResourceManageToolUtility.PathToGuid(depPath);
            if (depGuid.Equals(guid))
            {
                continue;
            }
            assetInfo.deps.Add(depGuid);
        }
        resultObj.assetTable.Add(guid, assetInfo);
    }
コード例 #2
0
    private void _GetAssetDependencies(Guid id, out List <U3DAssetInfo> assets)
    {
        U3DAssetInfo assetInfo = null;

        assets = new List <U3DAssetInfo>();

        if (!U3DAssetDB.GetInstance().Find(id, out assetInfo))
        {
            return;
        }

        string[] depPaths = ResourceManageToolUtility.GetDependencies(assetInfo.path);
        foreach (var p in depPaths)
        {
            if (p.Equals(assetInfo.Path))
            {
                continue;
            }

            U3DAssetInfo depAsset = null;
            Guid         depId    = ResourceManageToolUtility.PathToGuid(p);
            //在数据库中没有找到此资源则初始化
            if (!U3DAssetDB.GetInstance().Find(depId, out depAsset))
            {
                depAsset      = new U3DAssetInfo();
                depAsset.guid = depId;
                ResourceManageToolUtility.InitAssetInfo(p, ref depAsset);
                U3DAssetDB.GetInstance().AssetTable.Add(depAsset.guid, depAsset);
            }
            assets.Add(depAsset);
        }
        assets.Sort(new AssetInfoComparer(AssetFilterList));
    }