Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ContentDirectoryHandle

A handle that references a registered content directory.
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Struct
  • Namespace: Unity.Loading
  • Assembly: UnityEngine.ContentLoadModule
public struct ContentDirectoryHandle

Remarks

This handle is returned from ContentLoadManager.RegisterContentDirectory. 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.

Examples

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

BuildNameThe build name of the content directory (e.g. from the Manifest build name).
IsValidTrue if the handle is valid.