Version: Unity 6.6 Alpha (6000.6)
LanguageEnglish
  • C#

ContentLoadManager

class in Unity.Loading

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

Description

The ContentLoadManager offers APIs for accessing content that has been built. It is primarily used to register content directories and access root content.

In the Editor this is not typically used, because the content is available directly in the project using AssetDatabase and EditorSceneManager calls. However, it can be useful in Editor play mode to run the same loading case as the runtime and to try out the output of your Content Directory build, directly inside the Editor.

Additional resources: Loadable<T0>, LoadableSceneId, BuildPipeline.BuildContentDirectory

using Unity.Loading;
using UnityEngine;

namespace BuildDocExamples { public class ContentLoadManager_GetRootAssetsExample : MonoBehaviour { // Example catalog ScriptableObject with a Loadable field public class MyContentCatalog : ScriptableObject { public Loadable<Texture2D> previewIcon; }

void Start() { // After deploying a content directory next to the player, register it once at startup: var handle = ContentLoadManager.RegisterContentDirectory("/path/to/BuiltContent"); foreach (var catalog in ContentLoadManager.GetRootAssets<MyContentCatalog>()) { catalog.previewIcon.Load(); try { Texture2D icon = catalog.previewIcon.Target; // Use the icon... } finally { catalog.previewIcon.Release(); } } ContentLoadManager.UnregisterContentDirectory(handle); } } }

Static Methods

Method Description
GetContentDirectories Retrieves an ordered list of content directories.
GetRootAssets Retrieve all root assets of a specific type from all registered content directories.
RegisterContentDirectory Add the built-content in a directory to the ContentLoadManager. This makes it possible to load the contained Scenes and Assets.
UnregisterContentDirectory Remove access to content that had been loaded from a content directory.