GlobalObjectId

struct in UnityEditor

Switch to Manual

Description

Struct providing an API for stable, project-global object identifiers.

Provides a project-global object ID for lookup.

The ID is persistent and unique for a given Unity Object.

The format of the string representation of the ID is "GlobalObjectId_V1-{i}-{a}-{l}-{p}" where:
{i} is the identifier type represented by an integer (0 = Null, 1 = Imported Asset, 2 = Scene Object, 3 = Source Asset).
{a} is the asset GUID.
{l} is the local file ID of the object.
{p} is the prefab instance ID of the object.

The default null ID is "GlobalObjectId_V1-0-00000000000000000000000000000000-0-0".

Caveats:
- The ID changes when the object is moved to a new scene because the scene ID is part of the GlobalObjectID.

Variables

assetGUIDThe GUID for the asset to which this object belongs.
identifierTypeThe identifier type represented as an integer.
targetObjectIdThe local file ID of the object.
targetPrefabIdThe prefab instance id of the object.

Public Functions

EqualsCheck equality between two GlobalObjectIds.
ToStringGet the string representation of the GlobalObjectId.

Static Functions

GetGlobalObjectIdSlowConverts an Object reference or InstanceID to a GlobalObjectId.
GetGlobalObjectIdsSlowCreates an array of GlobalObjectIds based on an array of Objects or InstanceIDs.
GlobalObjectIdentifiersToInstanceIDsSlowCreates an array of InstanceIDs based on an array of GlobalObjectIds.
GlobalObjectIdentifiersToObjectsSlowCreates an array of Objects based on an array of GlobalObjectIds.
GlobalObjectIdentifierToInstanceIDSlowConverts a GlobalObjectId to an InstanceID.
GlobalObjectIdentifierToObjectSlowConverts a GlobalObjectId to an Object reference.
TryParseParses the string representation of a GlobalObjectId into a GlobalObjectId struct.