//default protected virtual void CreateAssetBundleInfo(ref AssetTreeData treeData, string assetpath, string assetbundlename) { AssetBundleInfo runtimeInfo = new AssetBundleInfo(); EditorAssetBundleInfo assetBundleInfo = new EditorAssetBundleInfo(); Object unityObject = AssetDatabase.LoadAssetAtPath <Object>(assetpath); assetBundleInfo.EditorInstanceId = unityObject.GetInstanceID(); //assetbundle info runtimeInfo.AssetBundleName = assetbundlename; runtimeInfo.AssetName = Path.GetFileNameWithoutExtension(assetpath); runtimeInfo.UnityPath = assetpath; runtimeInfo.AssetResType = AssetBundleFunction.TypeToResType(assetpath); //size runtimeInfo.AssetSize = Profiler.GetRuntimeMemorySizeLong(unityObject); if (runtimeInfo.AssetResType == AssetBundleResType.Image)//editor 下双倍内存 { runtimeInfo.AssetSize /= 2; } FileInfo fileInfo = new FileInfo(assetpath); runtimeInfo.FileSize = fileInfo.Length; //dependency List <string> collectList = ListPool <string> .Get(); List <string> editordependList = ListPool <string> .Get(); GenerateDependencies(collectList, editordependList, unityObject); //set dependencies runtimeInfo.DependNames = collectList.ToArray(); runtimeInfo.DepAssetBundleNames = new string[runtimeInfo.DependNames.Length]; for (int i = 0; i < runtimeInfo.DependNames.Length; i++) { var import = AssetImporter.GetAtPath(runtimeInfo.DependNames[i]); if (import != null) { runtimeInfo.DepAssetBundleNames[i] = import.assetBundleName; } } assetBundleInfo.EditorDependencies = editordependList.ToArray(); assetBundleInfo.RuntimeInfo = runtimeInfo; treeData.EditorInfo = assetBundleInfo; //set icon treeData.IconName = AssetTreeManager.mIns.GetIconName(runtimeInfo.AssetResType); treeData.FilePath = assetpath; treeData.DisplayName = Path.GetFileNameWithoutExtension(assetpath); ListPool <string> .Release(collectList); ListPool <string> .Release(editordependList); }
//default protected virtual void CreateDependencyInfo(ref DependencyTreeData treeData, AssetBundleInfo info) { EditorAssetBundleInfo assetBundleInfo = treeData.EditorInfo; assetBundleInfo.RuntimeInfo = info; //Object unityObject = AssetDatabase.LoadAssetAtPath<Object>(info.UnityPath); //assetBundleInfo.UnityObject = unityObject; //assetBundleInfo.TryBuildRefInfo(); treeData.EditorInfo = assetBundleInfo; //set icon treeData.IconName = AssetTreeManager.mIns.GetIconName(info.AssetResType); treeData.FilePath = info.UnityPath; treeData.DisplayName = Path.GetFileNameWithoutExtension(info.UnityPath); }