public DefaultAssetsAnalyzer(AssetListData listData) { _listData = listData; _timeline.Start(); _listData?.Begin(); JobScheduler.DispatchCoroutine(_Update()); }
public void End() { _stop = true; _timeline.Stop(); _listData.End(); if (_dirty) { AssetListData.WriteTo(_listDataPath, _listData); } }
public DefaultAssetsAnalyzer(string listDataPath) { _listDataPath = listDataPath; _listData = AssetListData.ReadFrom(_listDataPath) ?? new AssetListData(); _timeline.Start(); if (_listData.Begin()) { _dirty = true; } JobScheduler.DispatchCoroutine(_Update()); }
// 最终资源 private static bool CollectAsset(BundleBuilderData data, BundleBuilderData.BundleInfo bundle, string assetPath, PackagePlatform platform) { if (assetPath.EndsWith(Manifest.AssetListDataExt)) { var listData = AssetListData.ReadFrom(assetPath); return(CollectAssetList(data, bundle, listData, platform)); } for (var splitIndex = 0; splitIndex < bundle.splits.Count; splitIndex++) { var split = bundle.splits[splitIndex]; var ruleMatch = false; if (split.rules.Count > 0) { for (var ruleIndex = 0; ruleIndex < split.rules.Count; ruleIndex++) { var rule = split.rules[ruleIndex]; if (rule.exclude) { if (IsRuleMatched(rule, assetPath)) { break; } } else { if (IsRuleMatched(rule, assetPath)) { ruleMatch = true; break; } } } } else { ruleMatch = true; } if (ruleMatch) { if (!ContainsAsset(data, assetPath) && split.AddObject(assetPath, platform)) { CheckShaderVariants(data, bundle, assetPath, platform); } return(true); } } return(false); }
public static void CreateAssetListData() { var index = 0; do { var filePath = "Assets/unityfs_asset_list" + (index > 0 ? "_" + (index++) : "") + Manifest.AssetListDataExt; if (!File.Exists(filePath)) { var listData = new AssetListData(); AssetListData.WriteTo(filePath, listData); AssetDatabase.Refresh(); return; } } while (true); }
private static bool CollectAssetList(BundleBuilderData data, BundleBuilderData.BundleInfo bundle, AssetListData asset, PackagePlatform platform) { for (var index = 0; index < asset.timestamps.Count; index++) { var ts = asset.timestamps[index]; var assetPath = AssetDatabase.GUIDToAssetPath(ts.guid); // 剔除 filelist 对象 if (!Directory.Exists(assetPath)) { //TODO: 场景需要单独拆包 if (assetPath.EndsWith(".unity")) { continue; } var mainAsset = AssetDatabase.LoadMainAssetAtPath(assetPath); CollectAsset(data, bundle, mainAsset, assetPath, platform); } } return(true); }