文档

Unity Engine

Unity Engine

CreateLoadableObjectId

Creates a LoadableObjectId from a Object that can be used for on-demand loading.
阅读时间2 分钟最后更新于 1 个月前

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

LoadableObjectIdA 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

entityId

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

LoadableObjectIdA 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

guid

GUID
The GUID of the asset file containing the object.

The FileIdentifierType indicating whether this is a source asset, primary artifact, or non-asset reference.

localId

The local file identifier of the object within the asset.

Returns

Type

Description

LoadableObjectIdA 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).