public void AddRootTargets(FileInfo file) { AssetTarget target = AssetBundleUtil.Load(file); if (target == null) { XDebug.LogError(file); } target.exportType = AssetBundleExportType.Root; }
public void Analyze() { if (_isAnalyzed) { return; } _isAnalyzed = true; _cacheInfo = AssetBundleUtil.GetCacheInfo(assetPath); _isFileChanged = _cacheInfo == null || !_cacheInfo.fileHash.Equals(GetHash()) || !_cacheInfo.metaHash.Equals(_metaHash); if (_cacheInfo != null) { _bundleCrc = _cacheInfo.bundleCrc; if (_isFileChanged) { XDebug.Log("File was changed : ", assetPath); } } Object[] deps = EditorUtility.CollectDependencies(new Object[] { asset }); var res = from s in deps let path = AssetDatabase.GetAssetPath(s) where !path.StartsWith("Assets/Resources") && !(s is MonoScript) select path; var paths = res.Distinct().ToArray(); for (int i = 0; i < paths.Length; i++) { if (!File.Exists(paths[i]) && !paths[i].Contains("unity_builtin_extra")) { XDebug.Log("invalid:", paths[i]); continue; } FileInfo fi = new FileInfo(paths[i]); AssetTarget target = AssetBundleUtil.Load(fi); if (target == null) { continue; } AddDepend(target); target.Analyze(); } }