Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

ContentLoadManager.RegisterContentDirectory

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 ContentDirectoryHandle RegisterContentDirectory(string contentDirectoryPath);

Parameters

Parameter Description
contentDirectoryPath A local path pointing to a directory that contains the output from a call to BuildPipeline.BuildContentDirectory.

Returns

ContentDirectoryHandle A handle to the registered content directory, used to unregister it and to query its content.

Description

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.

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.