/// <summary> /// 打包 处理依赖关系 /// </summary> /// <param name="source"></param> static void fileWithDepends(string source) { string _source = Replace(source); if (_source == "") { return; } _source = _source.Substring(Application.dataPath.Length + 1); _source = "Assets/" + _source; string[] dps = AssetDatabase.GetDependencies(_source); foreach (var dp in dps) { if (dp.EndsWith(".cs")) { continue; } AssetImporter assetImporter = AssetImporter.GetAtPath(dp); string guid = AssetDatabase.AssetPathToGUID(dp); string fullname = dp.Replace("Assets/ForAssetbundleMaking/", ""); fullname = fullname.Substring(fullname.IndexOf('/') + 1); string bagname = fullname.Replace(Path.GetExtension(fullname), ".unity3d"); assetImporter.assetBundleName = bagname; Debug.Log("bagna:" + bagname); abConfig.AddAssetBundle(fullname, bagname); //资源名和包名关系 } }
public static AssetbundleConfig FromStr(string str) { AssetbundleConfig abc = new AssetbundleConfig(); string[] strs = str.Split('|'); if (strs.Length != 2) { return(null); } int.TryParse(strs[0], out abc.resourceVersion); string[] table = strs[1].Split(','); string[] kp; for (int i = 0; i < table.Length; i++) { kp = table[i].Split('&'); if (kp.Length == 2) { abc.AddAssetBundle(kp[0], kp[1]); } } return(abc); }