CreateLoadableObjectId
Creates a LoadableObjectId from a Object that can be used for on-demand loading.
Read time 2 minutesLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEditor
- Assembly: UnityEditor.CoreModule
CreateLoadableObjectId(Object)
Creates a LoadableObjectId from a Object that can be used for on-demand loading.
public static LoadableObjectId CreateLoadableObjectId(Object obj)
Parameters
A Unity Object that has been serialized to disk as part of an Asset. Objects inside Scenes cannot be referenced by LoadableObjectId.
Returns
Type | Description |
|---|---|
| LoadableObjectId | A LoadableObjectId that points to the specified object, or an empty LoadableObjectId if obj is null or if it does not belong to a persisted asset. |
CreateLoadableObjectId(EntityId)
Creates a LoadableObjectId from an EntityId.
public static LoadableObjectId CreateLoadableObjectId(EntityId entityId)
Parameters
The EntityId of a Unity Object that has been serialized to disk as part of an Asset. Objects inside Scenes cannot be referenced by LoadableObjectId.
Returns
Type | Description |
|---|---|
| LoadableObjectId | A LoadableObjectId that points to the specified object. |
CreateLoadableObjectId(GUID, FileIdentifierType, long)
Creates a LoadableObjectId from its component parts.
public static LoadableObjectId CreateLoadableObjectId(GUID guid, FileIdentifierType fileType, long localId)
Parameters
The FileIdentifierType indicating whether this is a source asset, primary artifact, or non-asset reference.
The local file identifier of the object within the asset.
Returns
Type | Description |
|---|---|
| LoadableObjectId | A LoadableObjectId constructed from the specified components. |
Remarks
This method is the inverse of LoadableObjectIdEditorUtility.TryDeconstructLoadableObjectId: it reconstructs a LoadableObjectId from the GUID, file identifier type, and local file identifier. Use LoadableObjectIdEditorUtility.CreateLoadableObjectId or LoadableObjectIdEditorUtility.CreateLoadableObjectId when constructing a reference from a live Object; use this overload only when the component parts are already known (for example, when persisting and restoring a reference in tooling).
Additional Resources: LoadableObjectIdEditorUtility.TryDeconstructLoadableObjectId, GlobalObjectId