コード例 #1
0
        public static void Build(string externalResourcesPath)
        {
            var exportPath = GetExportPath();

            if (string.IsNullOrEmpty(exportPath))
            {
                return;
            }

            if (Directory.Exists(exportPath))
            {
                Directory.Delete(exportPath, true);
            }

            EditorApplication.LockReloadAssemblies();

            #if ENABLE_CRIWARE
            CriAssetGenerator.Generate(exportPath, externalResourcesPath);
            #endif

            // CriAssetGeneratorでCriのManifestファイルを生成後に実行.
            var assetBundleManifest = BuildAssetBundle.BuildAllAssetBundles(exportPath);

            // ビルド成果物の情報をAssetInfoManifestに書き込み.
            AssetInfoManifestGenerator.SetAssetFileInfo(exportPath, externalResourcesPath, assetBundleManifest);

            // 再度AssetInfoManifestだけビルドを実行.
            BuildAssetBundle.BuildAssetInfoManifest(exportPath, externalResourcesPath);

            // 不要ファイル削除.
            BuildAssetBundle.DeleteUnUseFiles(exportPath);

            // AssetBundleファイルをパッケージ化.
            BuildAssetBundle.BuildPackage(exportPath);

            EditorApplication.UnlockReloadAssemblies();

            UnityConsole.Event(ExternalResources.ConsoleEventName, ExternalResources.ConsoleEventColor, "Build ExternalResource Complete.");
        }