BuildContentDirectory(BuildContentDirectoryParameters)
Builds a content directory (serialized assets and scenes plus a manifest) at a defined output path.
Read time 1 minuteLast updated 13 days ago
Definition
- Type: Method
- Namespace: UnityEditor
- Assembly: UnityEditor.CoreModule
public static BuildReport BuildContentDirectory(BuildContentDirectoryParameters buildParameters)
Parameters
The build settings to use for the build, such as paths, roots, options, and compression.
Returns
Type | Description |
|---|---|
| BuildReport | The BuildReport that contains the results and details of the build. |
Remarks
Use to configure the build, including the root assets to include, the output path, and optional compression and build options. Each entry in _rootAssetPaths must be a ScriptableObject. The build includes those root assets and everything they reference, such as assets referenced through LoadableObjectId, Loadable<T>, and LoadableSceneId.
buildParametersThe method creates _outputPath if it doesn't exist, normalizes path separators, and defaults _name to the output folder name.
The build uses _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.
To load the built content, register the output directory with ContentLoadManager.RegisterContentDirectory.
Additional Resources: BuildContentDirectoryParameters, ContentLoadManager
Examples
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); } }}