Version: Unity 6.4 Beta (6000.4)
LanguageEnglish
  • C#

EntityId

struct in UnityEngine

/

Implemented in:UnityEngine.CoreModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

A unique identifier for a Unity object.

The internal representation of EntityId is an implementation detail and night change between versions. To ensure compatibility, avoid the following patterns:

- Casting EntityId to or from an integer type. - Assuming any particular bit layout or sign conventions. - Using Object.GetHashCode to obtain an EntityId. - Serializing EntityId with ToString and deserializing with integer parsing. - Sorting EntityId values to determine creation order. - Manipulating individual bits of the EntityId value.

Use the provided API methods such as GetRawData, IsValid, Equals, and GetHashCode for working with EntityId values.

Note: Code that previously used InstanceID as an integer should be updated to use the EntityId API methods instead.

Static Properties

Property Description
NoneGets an EntityId that represents no valid Object or Entity. Use this to indicate an invalid or unassigned identifier.

Public Methods

Method Description
CompareToCompares this EntityId to another EntityId.
EqualsDetermines whether the specified object is equal to this EntityId.
GetHashCodeReturns a hash code for this EntityId.
GetRawDataReturns the raw internal data of this EntityId.
IsValidDetermines whether this EntityId represents a valid entity.
ToStringReturns a string representation of this EntityId.

Operators

Operator Description
operator !=Determines whether two EntityId instances are not equal.
operator <Determines whether the first EntityId is less than the second.
operator ==Determines whether two EntityId instances are equal.
operator >Determines whether the first EntityId is greater than the second.
Unknown operatorDetermines whether the first EntityId is less than or equal to the second.
Unknown operatorDetermines whether the first EntityId is greater than or equal to the second.