A low-level reference to an object within an asset, used to pull assets into a ContentDirectory build, and for on-demand loading.
LoadableObjectId is the underlying reference type used by Loadable<T0>. It contains the information needed
to identify and load a specific object from built content.
In the Editor, use LoadableObjectIdEditorUtility to create LoadableObjectIds. Typically these
will be serialized as part of Loadable{T} fields on ScriptableObject-derived classes. When those ScriptableObjects are
built as part of a Content Directory, the assets referenced by the LoadableObjectId are recursively pulled into
the build output. At runtime, the ContentLoadManager resolves LoadableObjectIds to the
correct built content as long as it is part of the currently registered content directories.
Player and AssetBundle builds do not pull assets referenced by LoadableObjectId into the build, this is only supported
by BuildPipeline.BuildContentDirectory.
Additional resources: Loadable<T0>, LoadableObjectIdEditorUtility
using Unity.Loading; using UnityEngine;
namespace BuildDocExamples { // Example showing how LoadableObjectId is used in practice [CreateAssetMenu] public class Catalog : ScriptableObject { public LoadableObjectId iconId; }
public class LoadableObjectId_Example { public void ExampleUsage() { // In the editor, assign iconId via LoadableObjectIdEditorUtility.CreateLoadableObjectId(iconTexture); Catalog catalog = ScriptableObject.CreateInstance<Catalog>();
// At runtime, bridge LoadableObjectId to Loadable<T> for the runtime API: Loadable<Texture2D> iconLoadable = new Loadable<Texture2D>(catalog.iconId); iconLoadable.Load(); // Use iconLoadable.Target... iconLoadable.Release(); } } }
| Property | Description |
|---|---|
| IsValid | True if this LoadableObjectId is initialized with valid data. |
| Method | Description |
|---|---|
| ToString | Returns a string representation of this LoadableObjectId. |