/** 作成。 * * a_assets_path : 出力フォルダ。「Assets」からの相対パス。 * a_list : アセットバンドル化するリスト。 * a_buildoption : ビルドオプション。 * a_buildtarget : ビルドターゲット。 * return.result == true : 成功。 * */ public static MultiResult <bool, UnityEngine.AssetBundleManifest> TryCreate(string a_assets_path, UnityEditor.AssetBundleBuild[] a_list, UnityEditor.BuildAssetBundleOptions a_buildoption, UnityEditor.BuildTarget a_buildtarget) { #pragma warning disable 0168 try{ return(new MultiResult <bool, UnityEngine.AssetBundleManifest>(true, Create(a_assets_path, a_list, a_buildoption, a_buildtarget))); }catch (System.Exception t_exception) { #if (DEF_BLUEBACK_ASSETLIB_ASSERT) DebugTool.Assert(false, t_exception); #endif return(new MultiResult <bool, UnityEngine.AssetBundleManifest>(false, null)); } #pragma warning restore }
/** 作成。 * * a_assets_path : 出力フォルダ。「Assets」からの相対パス。 * a_list : アセットバンドル化するリスト。 * a_buildoption : ビルドオプション。 * a_buildtarget : ビルドターゲット。 * */ public static UnityEngine.AssetBundleManifest Create(string a_assets_path, UnityEditor.AssetBundleBuild[] a_list, UnityEditor.BuildAssetBundleOptions a_buildoption, UnityEditor.BuildTarget a_buildtarget) { return(UnityEditor.BuildPipeline.BuildAssetBundles("Assets/" + a_assets_path, a_list, a_buildoption, a_buildtarget)); }
/** コンバート。アセットバンドル作成。 * * a_param : パラメータ。 * a_assets_path : アセットフォルダからの相対パス。 * a_sheet : JSONシート。 * */ public static void Convert_CreateAssetBundle(string a_param, Fee.File.Path a_assets_path, Fee.JsonItem.JsonItem[] a_sheet) { try{ if (a_sheet != null) { //アセットバンドルリスト作成 /* * { * "se.assetbundle" : { * { * "SE" : * "Editor/Test12/se" * }, * { * "UI_BUTTON" : * "Common/Texture/ui_button" * }, * { * "IMAGE" : * "Common/Texture/image.jpg" * }, * * ... * }, * "xx.assetbundle" : { * * }, * ... * } */ System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, ListItem> > t_assetbundlelist = new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, ListItem> >(); { for (int ii = 0; ii < a_sheet.Length; ii++) { if (a_sheet[ii] != null) { System.Collections.Generic.List <ListItem> t_sheet = Fee.JsonItem.Convert.JsonItemToObject <System.Collections.Generic.List <ListItem> >(a_sheet[ii]); if (t_sheet != null) { for (int jj = 0; jj < t_sheet.Count; jj++) { if (string.IsNullOrEmpty(t_sheet[jj].data_assetbundle_name) == false) { switch (t_sheet[jj].data_command) { case Convert_DataSheet.DATACOMMAND_RESOURCES_PREFAB: case Convert_DataSheet.DATACOMMAND_RESOURCES_TEXTURE: case Convert_DataSheet.DATACOMMAND_RESOURCES_TEXT: { System.Collections.Generic.Dictionary <string, ListItem> t_item_list = null; if (t_assetbundlelist.TryGetValue(t_sheet[jj].data_assetbundle_name, out t_item_list) == false) { t_item_list = new System.Collections.Generic.Dictionary <string, ListItem>(); t_assetbundlelist.Add(t_sheet[jj].data_assetbundle_name, t_item_list); } t_item_list.Add(t_sheet[jj].data_id, t_sheet[jj]); } break; default: { Tool.Assert(false); } break; } } else { //アセットバンドルなし。 } } } else { Tool.Assert(false); } } } } switch (a_param) { case Convert_DataSheet.DATAPARAM_DUMMY: { //ダミー。 foreach (System.Collections.Generic.KeyValuePair <string, System.Collections.Generic.Dictionary <string, ListItem> > t_pair in t_assetbundlelist) { Fee.AssetBundleList.DummryAssetBundle t_dummy_assetbundle = new AssetBundleList.DummryAssetBundle(); //asset_list t_dummy_assetbundle.asset_list = new System.Collections.Generic.Dictionary <string, string>(); //key_list System.Collections.Generic.List <string> t_key_list = new System.Collections.Generic.List <string>(t_pair.Value.Keys); for (int ii = 0; ii < t_key_list.Count; ii++) { //asset_name string t_asset_name = t_key_list[ii]; ListItem t_listitem; if (t_pair.Value.TryGetValue(t_asset_name, out t_listitem) == true) { t_dummy_assetbundle.asset_list.Add(t_asset_name, t_listitem.data_path); } else { Tool.Assert(false); } } Fee.File.Path t_path = new File.Path(a_assets_path.GetPath() + t_pair.Key + ".json"); string t_jsonstring = Fee.JsonItem.Convert.ObjectToJsonString <Fee.AssetBundleList.DummryAssetBundle>(t_dummy_assetbundle); EditorTool.Utility.WriteTextFile(Fee.File.Path.CreateAssetsPath(t_path), t_jsonstring, true); } } break; case Convert_DataSheet.DATAPARAM_STANDALONEWINDOWS: case Convert_DataSheet.DATAPARAM_ANDROID: case Convert_DataSheet.DATAPARAM_WEBGL: case Convert_DataSheet.DATAPARAM_IOS: { //アセットバンドル。 //t_assetbundle_build UnityEditor.AssetBundleBuild[] t_assetbundle_build = new UnityEditor.AssetBundleBuild[t_assetbundlelist.Count]; { int t_count = 0; foreach (System.Collections.Generic.KeyValuePair <string, System.Collections.Generic.Dictionary <string, ListItem> > t_pair in t_assetbundlelist) { //パック名。 t_assetbundle_build[t_count].assetBundleName = t_pair.Key; //assetBundleVariant t_assetbundle_build[t_count].assetBundleVariant = null; //key_list System.Collections.Generic.List <string> t_key_list = new System.Collections.Generic.List <string>(t_pair.Value.Keys); t_assetbundle_build[t_count].assetNames = new string[t_key_list.Count]; #if (UNITY_5) //未対応。 #else t_assetbundle_build[t_count].addressableNames = new string[t_key_list.Count]; #endif for (int ii = 0; ii < t_key_list.Count; ii++) { ListItem t_listitem; if (t_pair.Value.TryGetValue(t_key_list[ii], out t_listitem) == true) { string t_asset_path = null; { try{ UnityEngine.Object t_object = UnityEngine.Resources.Load(t_listitem.data_path); if (t_object != null) { t_asset_path = UnityEditor.AssetDatabase.GetAssetPath(t_object); } else { Tool.Assert(false); } }catch (System.Exception t_exception) { Tool.DebugReThrow(t_exception); } } //assetNames t_assetbundle_build[t_count].assetNames[ii] = t_asset_path; //addressableNames #if (UNITY_5) //未対応。 #else t_assetbundle_build[t_count].addressableNames[ii] = t_key_list[ii]; #endif } else { Tool.Assert(false); } } t_count++; } } //BuildAssetBundleOptions UnityEditor.BuildAssetBundleOptions t_option = UnityEditor.BuildAssetBundleOptions.ForceRebuildAssetBundle; //BuildTarget UnityEditor.BuildTarget t_buildtarget = UnityEditor.BuildTarget.StandaloneWindows; switch (a_param) { case Convert_DataSheet.DATAPARAM_STANDALONEWINDOWS: { t_buildtarget = UnityEditor.BuildTarget.StandaloneWindows; } break; case Convert_DataSheet.DATAPARAM_ANDROID: { t_buildtarget = UnityEditor.BuildTarget.Android; } break; case Convert_DataSheet.DATAPARAM_WEBGL: { t_buildtarget = UnityEditor.BuildTarget.WebGL; } break; case Convert_DataSheet.DATAPARAM_IOS: { t_buildtarget = UnityEditor.BuildTarget.iOS; } break; default: { Tool.Assert(false); } break; } if (System.IO.Directory.Exists("Assets/" + a_assets_path.GetPath()) == false) { System.IO.Directory.CreateDirectory("Assets/" + a_assets_path.GetPath()); } UnityEditor.BuildPipeline.BuildAssetBundles("Assets/" + a_assets_path.GetPath(), t_assetbundle_build, t_option, t_buildtarget); } break; default: { Tool.Assert(false); } break; } } else { Tool.Assert(false); } }catch (System.Exception t_exception) { Tool.DebugReThrow(t_exception); } }
public static System.Boolean BuildAssetBundle(UnityEngine.Object mainAsset, UnityEngine.Object[] assets, System.String pathName, UnityEditor.BuildAssetBundleOptions options) { throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet."); }
/** アセットバンドル。作成。 */ public static void BuildAssetBundles(Fee.File.Path a_path, UnityEditor.AssetBundleBuild[] a_list, UnityEditor.BuildAssetBundleOptions a_option, UnityEditor.BuildTarget a_buildtarget) { try{ UnityEditor.BuildPipeline.BuildAssetBundles("Assets/" + a_path.GetPath(), a_list, a_option, a_buildtarget); }catch (System.Exception t_exception) { Tool.EditorLogError(t_exception.Message); } }