public void AddRootTarget(string assetFilePath) { if (File.Exists(assetFilePath) == false) { return; } FileInfo fileInfo = new FileInfo(assetFilePath); if (fileInfo.Extension.Contains("meta")) { return; } AssetBuildInfo assetBuildInfo = Load(fileInfo); assetBuildInfo.exportType = AssetBundleExportType.Root; }
public AssetBuildInfo Load(FileInfo fileInfo, Type type) { AssetBuildInfo assetBuildInfo = null; string fullPath = fileInfo.FullName(); int indexEnd = fullPath.IndexEndOf(FilePathConst.ProjectPath); if (indexEnd != -1) { string assetPath = fullPath.Substring(indexEnd + 1); if (_assetPath2buildInfo.ContainsKey(assetPath)) { assetBuildInfo = _assetPath2buildInfo[assetPath]; } else { Object obj = type == null ? AssetDatabase.LoadMainAssetAtPath(assetPath) : AssetDatabase.LoadAssetAtPath(assetPath, type); if (obj != null) { int instanceId = obj.GetInstanceID(); if (_object2buildInfo.ContainsKey(instanceId)) { assetBuildInfo = _object2buildInfo[instanceId]; } else { assetBuildInfo = new AssetBuildInfo(obj, fileInfo, assetPath); _assetPath2buildInfo[assetPath] = assetBuildInfo; _object2buildInfo[instanceId] = assetBuildInfo; } } } } return(assetBuildInfo); }