// public void Build(string strIn,SearchOption kSearchOpt = SearchOption.TopDirectoryOnly ) // { // if(false == PathUtil.IsDirectory(strIn)) // return; // string strABName = GetABName(strIn); // if(null == strABName) // return ; // string strAssetPath = PathUtil.GetPathUnderAssets(strIn); // List<string> strFileList = PathUtil.GetFileNameWithPostfix(strIn,strAssetPath,kSearchOpt); // if(0 == strFileList.Count) // return; // string strOutPath = PathUtil.Res2ABPathConvert(strAssetPath); // int iIdx = strOutPath.LastIndexOf("/"+strABName); // if( -1 != iIdx) // strOutPath = strOutPath.Substring(0,iIdx); // PathUtil.CreateDirectory(Application.dataPath+"/../" + strOutPath); // AssetBundleBuild[] kBuildMap = new AssetBundleBuild[1]; // kBuildMap[0].assetBundleName = strABName + AssetCustomSetting.ABPostfix; // kBuildMap[0].assetNames = strFileList.ToArray(); // Log.I(strOutPath); // AssetBundleManifest kManifest = BuildPipeline.BuildAssetBundles(strOutPath,kBuildMap,m_BuildOption,mBuildTarget); // if(null == kManifest) // Debug.LogError("Build AssetBundle Failed"); // } public void SetAssetBundleNameByRule(ABRuleAsset RuleAsset) { if (null == RuleAsset) { return; } List <ABRuleAsset.ABRuleData> mRuleDatas = RuleAsset.GetABRuleDatas(); for (int i = 0; i < mRuleDatas.Count; i++) { var ruleData = mRuleDatas[i]; string AssestPath = Application.dataPath + "/" + ruleData.Path; switch (ruleData.BuildType) { case ABRuleAsset.ABBuildType.AllPack: SetAllInOnePack(AssestPath); break; case ABRuleAsset.ABBuildType.PathPack: SetPerPathOnePack(AssestPath); break; case ABRuleAsset.ABBuildType.FilePack: SetPerFileOnePack(AssestPath); break; } } }
public void BuildFromRuleAsset(ABRuleAsset RuleAsset, string outputPath = null) { SetAssetBundleNameByRule(RuleAsset); Build(outputPath); }