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

ContentDirectoryHandle

struct 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

A handle that references a registered content directory and is returned from the RegisterContentDirectory operation in ContentLoadManager.

Keep the handle to call ContentLoadManager.UnregisterContentDirectory after all loadables and scenes from that directory are released. Valid handles expose metadata such as ContentDirectoryHandle.BuildName from the content manifest, and can be used to query root assets from a specific content directory via ContentLoadManager.GetRootAssets.

Additional resources: ContentLoadManager.RegisterContentDirectory, ContentLoadManager.RegisterContentDirectory

using Unity.Loading;
using UnityEngine;

namespace BuildDocExamples { public class ContentDirectoryHandle_RegisterUnregisterExample : MonoBehaviour { void Start() { string path = Application.streamingAssetsPath + "/DLC/MyContent"; ContentDirectoryHandle handle = ContentLoadManager.RegisterContentDirectory(path); try { ScriptableObject[] roots = ContentLoadManager.GetRootAssets<ScriptableObject>(handle); // Load assets from roots, then release loadables and unload scenes before unregistering. } finally { ContentLoadManager.UnregisterContentDirectory(handle); } } } }

Properties

Property Description
BuildName The build name of the content directory (e.g. from the Manifest build name).
IsValidTrue if the handle is valid.