Version: Unity 6.6 Alpha (6000.6)
LanguageEnglish
  • C#

BuildPipeline.BuildContentDirectory

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static BuildReport BuildContentDirectory(BuildContentDirectoryParameters buildParameters);

Parameters

Parameter Description
buildParameters The build settings to use for the build, such as paths, roots, options, and compression.

Returns

BuildReport The BuildReport that contains the results and details of the build.

Description

Builds a content directory (serialized assets and scenes plus a manifest) at a defined output path.

Register the folder at runtime with ContentLoadManager.RegisterContentDirectory. Each entry in BuildContentDirectoryParameters.rootAssetPaths must be a ScriptableObject; the build includes those roots and everything they reference (including LoadableObjectId, Loadable<T0>, and LoadableSceneId). Creates an outputPath if missing, normalizes path separators, and defaults BuildContentDirectoryParameters.name to the output folder name.

The build uses EditorUserBuildSettings.activeBuildTarget and the active subtarget configured for that target in the build settings. Select the intended platform in the Build Profile window or through command line arguments so that the active target is set to the desired setting prior to calling this method.

Additional resources: BuildContentDirectoryParameters, ContentLoadManager

using UnityEditor;
using UnityEngine;

namespace BuildDocExamples { public class BuildPipeline_BuildContentDirectoryExample { [MenuItem("BuildDocExamples/Build/Build Content Directory")] public static void BuildContentDirectoryExample() { var parameters = new BuildContentDirectoryParameters { outputPath = "Builds/MyContentDirectory", rootAssetPaths = new[] { "Assets/MyRootAsset.asset" }, options = BuildContentOptions.None };

BuildPipeline.BuildContentDirectory(parameters); } } }