Version: Unity 6.6 Alpha (6000.6)
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.

Description

Add the built-content in a directory to the ContentLoadManager. This makes it possible to load the contained Scenes and Assets.

In the runtime this is required when BuildPipeline.BuildContentDirectory has been used to build and distribute additional content.

This can be called multiple times with different paths to expose the contents of additional content directories to the editor/runtime. However, this method is bound to a specific directory structure and limited to one build per directory. Use ContentLoadManager.RegisterContentDirectory lower-level API when you need more flexibility in content organization or when registering multiple builds from custom locations.

For a clean shutdown, each call to RegisterContentDirectory should be matched with a call to UnregisterContentDirectory.

Registering a content directory is not supported in the Editor outside of Play Mode and will throw InvalidOperationException. Enter Play Mode before calling this method from Editor code.

Throws InvalidOperationException if called from the Editor outside of Play Mode, if the path is already registered, or if the content manifest cannot be loaded. Throws IO.FileNotFoundException if the required manifest hash file is not found. Throws IO.DirectoryNotFoundException if the directory does not exist.