ContentDirectoryHandle
A handle that references a registered content directory.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前
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.
Additional Resources: ContentLoadManager.RegisterContentDirectory
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); } } }}