| Parameter | Description |
|---|---|
| contentDirectoryPath | A local path pointing to a directory that contains the output from a call to BuildPipeline.BuildContentDirectory. |
ContentDirectoryHandle A handle to the registered content directory, used to unregister it and to query its content.
Add the built-content in a directory to the ContentLoadManager. This makes it possible to load the contained Scenes and Assets.
At runtime, call this for each content directory that BuildPipeline.BuildContentDirectory produced and
that you distribute alongside the Player, so that the scenes and assets it contains can be loaded. You can call it multiple
times with different paths to register several content directories, but each directory is limited to a single build.
Match every call with a corresponding call to ContentLoadManager.UnregisterContentDirectory once all loadables and scenes
from the directory are released.
Any local file system path works, and Unity provides no mechanism or convention for discovering content directories
on disk. The exception is content that ships with the Player, which you build into a subfolder of the
StreamingAssets folder and locate at runtime through Application.streamingAssetsPath. Refer to
Include additional files in a build for details.
In the Editor, registration is only supported in Play mode, where it lets you load and test built content the same way
the runtime does. Outside of Play mode the content is already available through AssetDatabase,
LoadableObjectIdEditorUtility and LoadableSceneIdEditorUtility, so registration is unnecessary and throws InvalidOperationException.
To load built content in Play mode, build it with type trees. Content built with
BuildContentOptions.DisableWriteTypeTree can only be loaded by a runtime that matches the
build environment exactly, so the Editor cannot read it.