A unique identifier for a Unity object.
The internal representation of EntityId is an implementation detail and might change between versions. To ensure compatibility, avoid the following patterns:
EntityId to or from an integer type.Object.GetHashCode to obtain an EntityId.EntityId with ToString and deserializing with integer parsing.EntityId values to determine creation order.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.
| Property | Description |
|---|---|
| None | Gets an EntityId that represents no valid Object or Entity. Use this to indicate an invalid or unassigned identifier. |
| Method | Description |
|---|---|
| CompareTo | Compares this EntityId to another EntityId. |
| Equals | Determines whether the specified object is equal to this EntityId. |
| GetHashCode | Returns a hash code for this EntityId. |
| IsValid | Determines whether this EntityId represents a valid entity. |
| ToString | Returns a string representation of this EntityId. |
| Method | Description |
|---|---|
| FromULong | Creates an EntityId from raw ulong data. This should have come from another valid EntityId. (Use at your own risk. And bit arrangement might change.) |
| ToULong | Gets the raw data of the EntityId. (Use at your own risk. And bit arrangement might change.) |
| 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 the first EntityId is less than or equal to the second. |
| operator == | Determines whether two EntityId instances are equal. |
| operator > | Determines whether the first EntityId is greater than the second. |
| operator >= | Determines whether the first EntityId is greater than or equal to the second. |