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 Build settings (paths, roots, platform, options, compression).

Returns

BuildReport The BuildReport for this build.

Description

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

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

Additional resources: BuildContentDirectoryParameters, Unity.Loading.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); } } }