Пример #1
0
    public static void Build()
    {
        if (Directory.Exists(folderPath))
        {
            Directory.Delete(folderPath, true);
        }
        if (Directory.Exists(k_TmpPath))
        {
            Directory.Delete(k_TmpPath, true);
        }

        Directory.CreateDirectory(folderPath);
        Directory.CreateDirectory(k_TmpPath);

        IBundleBuildParameters buildParams = new BundleBuildParameters(EditorUserBuildSettings.activeBuildTarget, BuildTargetGroup.Unknown, folderPath);

        buildParams.TempOutputFolder = k_TmpPath;

        IBundleBuildContent buildContent = new BundleBuildContent(ContentBuildInterface.GenerateAssetBundleBuilds());
        IBundleBuildResults results;

        List <IBuildTask> taskList = DefaultBuildTasks.Create(DefaultBuildTasks.Preset.AssetBundleBuiltInShaderExtraction) as List <IBuildTask>;

        taskList.Add(new RefreshAssetDatabase());
        taskList.Add(new CreateBuiltTimeReport());

        ReturnCode exitCode = ContentPipelineProfiled.BuildAssetBundles(buildParams, buildContent, out results, taskList, new Profiler("Total"));

        Debug.Log("Building completed with " + exitCode);
    }
    public static void Build()
    {
        ReadCommandLine();

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

        Directory.CreateDirectory(folderPath);
        Directory.CreateDirectory(k_TmpPath);

        IBundleBuildParameters buildParams = new BundleBuildParameters(EditorUserBuildSettings.activeBuildTarget, BuildTargetGroup.Unknown, folderPath);

        buildParams.TempOutputFolder = k_TmpPath;

        IBundleBuildContent buildContent = new BundleBuildContent(ContentBuildInterface.GenerateAssetBundleBuilds());
        IBundleBuildResults results;

        List <IBuildTask> taskList = DefaultBuildTasks.Create(DefaultBuildTasks.Preset.AssetBundleBuiltInShaderExtraction) as List <IBuildTask>;

        taskList.Add(new RefreshAssetDatabase());

        // we add a callback after generating information about how to build each bundle
        ContentPipeline.BuildCallbacks.PostPackingCallback += PostPackingCallback;

        ReturnCode exitCode = ContentPipeline.BuildAssetBundles(buildParams, buildContent, out results, taskList);

        Debug.Log("Building completed with " + exitCode);
    }
Пример #3
0
        public void BuildAssetBundles_WhenBuildLogProvided_DoesNotCreatePerformanceLogReport()
        {
            IBundleBuildParameters buildParameters = GetBuildParameters();
            IBundleBuildContent    buildContent    = GetBundleContent();
            IBundleBuildResults    results;

            var taskList = DefaultBuildTasks.Create(DefaultBuildTasks.Preset.AssetBundleCompatible);

            ContentPipeline.BuildAssetBundles(buildParameters, buildContent, out results, taskList, new BuildLog());

            string tepBuildLog = buildParameters.GetOutputFilePathForIdentifier("buildlogtep.json");

            FileAssert.DoesNotExist(tepBuildLog);
        }
Пример #4
0
        /// <summary> 指定されたアセットバンドルをビルド </summary>
        public BuildResult Build(string outputPath, AssetBundleBuild[] buildMap)
        {
            var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(BuildTarget);

            var buildParams = new BundleBuildParameters(BuildTarget, buildTargetGroup, outputPath)
            {
                BundleCompression = BuildCompression.LZ4,
            };

            var buildContent = new BundleBuildContent(buildMap);

            var tasks = DefaultBuildTasks.Create(DefaultBuildTasks.Preset.AssetBundleBuiltInShaderExtraction);

            var exitCode = ContentPipeline.BuildAssetBundles(buildParams, buildContent, out var results, tasks);

            return(new BuildResult(exitCode, results));
        }
Пример #5
0
        public ReturnCode DryRun()
        {
            var logHandler = settings.GetBuildLogHandler();

            logHandler.Apply();

            var helper   = settings.GetBuildHelper();
            var contexts = new BuildContext();

            contexts.SetContextObject(new BundleBuildParameters(helper.BuildTarget, helper.BuildTargetGroup, Application.streamingAssetsPath));
            contexts.SetContextObject(new BuildInterfacesWrapper());
            contexts.SetContextObject(new BuildResults());
            contexts.SetContextObject(new BuildCallbacks());

            ReturnCode returnCode = BuildTasksRunner.Run(DefaultBuildTasks.Create(DefaultBuildTasks.Preset.PlayerScriptsOnly), contexts);

            logHandler.Revert();

            return(returnCode);
        }
Пример #6
0
    public static void Build()
    {
        var buildContent = new BundleBuildContent(ContentBuildInterface.GenerateAssetBundleBuilds());
        var buildParams  = new CustomBuildParameters(EditorUserBuildSettings.activeBuildTarget, EditorUserBuildSettings.selectedBuildTargetGroup, "Assets/StreamingAssets");

        // This is a part of the CustomBuildParameters class that override the outputFolder on a per AssetBundle basic
        buildParams.m_PerBundleBuildFolder.Add("textures", "Assets/StreamingAssets/OtherFolder");

        // This is a part of the CustomBuildParameters class that ignores the outputFolder, and gives a direct location, including the filename. On a per AssetBundle basic
        buildParams.m_PerBundleAbsolutePath.Add("prefabs", Application.dataPath.Substring(0, Application.dataPath.Length - 6) + "myPrefabObjects.ab");

        buildParams.BundleCompression = BuildCompression.LZMA;

        List <IBuildTask> taskList = DefaultBuildTasks.Create(DefaultBuildTasks.Preset.AssetBundleBuiltInShaderExtraction) as List <IBuildTask>;

        //taskList.Add( new MoveAssetBundles() ); // no longer needed from "1.2.3-preview" as can use
        taskList.Add(new RefreshAssetDatabase());

        IBundleBuildResults results;
        ReturnCode          exitCode = ContentPipeline.BuildAssetBundles(buildParams, buildContent, out results, taskList);

        Debug.Log("Building per bundle completed with " + exitCode);
    }