这个文件主要定义了AssetUnit这个数据结构。
保存了单个文件的各种信息。
AssetUnit.cs:
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class AssetUnit
{
public string mPath;
public string mName;
public string mSuffix;
public int mLevel;
public int mIndex;
public int mAssetSize;
public List<string> mAllDependencies;
public List<AssetUnit> mNextLevelDependencies;
public List<AssetUnit> mDirectUpperDependences;
public AssetUnit(string path)
{
mAssetSize = 0;
mPath = path;
mName = BuildCommon.getFileName(mPath, true);
mSuffix = BuildCommon.getFileSuffix(mName);
mLevel = BuildCommon.getAssetLevel(mPath);
mAllDependencies = new List<string>();
mNextLevelDependencies = new List<AssetUnit>();
string[] deps = AssetDatabase.GetDependencies(new string[] { mPath });
foreach (string file in deps)
{
string suffix = BuildCommon.getFileSuffix(file);
if (file == mPath || suffix == "dll")
continue;
mAllDependencies.Add(file);
}
mDirectUpperDependences = new List<AssetUnit>();
}
}