Documentation

Unity Engine


Unity Engine


TypeIndex

Provides a unique id for component types as well as quick lookup information about the component type itself. This value is fully deterministic at runtime but should not be considered deterministic across builds and thus should not be serialized. For serialization, please prefer TypeManager.TypeInfo.StableTypeHash instead.
Read time 3 minutesLast updated 2 days ago

Definition

public struct TypeIndex : IComparable<TypeIndex>, IEquatable<TypeIndex>

Fields

Value

Description

ValueRaw value used to identify Component types at runtime.

Properties

Property

Description

FlagsType flags stored in Value
HasEntityReferencesThe component type contains an Entity member. Entity members found in nested member types will also cause this property to return true.
HasNativeContainerThe component type contains a NativeContainerAttribute decorated member. NativeContainer members found in nested member types will also cause this property to return true.
HasOnAddedCallbackThe component type has an OnAddedCallback.
HasOnRemovedCallbackThe component type has an OnRemovedCallback.
IndexZero-based index for the TypeIndex stored in Value (the type index with no flags).
IsBakingOnlyTypeThe component type is decorated with the BakingTypeAttribute attribute.
IsBufferThe component type inherits from IBufferElementData
IsChunkComponentThe component type is used as a chunk component (a component mapped to a Chunk rather than Entity)
IsChunkSerializableThe component type is appropriate for chunk serialization. Such types are blittable without containing pointer types or have been decorated with ChunkSerializableAttribute.
IsCleanupBufferComponentThe component type inherits from ICleanupBufferElementData
IsCleanupComponentThe component type inherits from ICleanupComponentData
IsCleanupSharedComponentThe component type inherits from ICleanupSharedComponentData
IsComponentTypeThe component type inherits from IComponentData
IsEnableableThe component type inherits from IEnableableComponent
IsIEquatableThe component type inherits from IEquatable_1
IsRefCountedThe component type inherits from IRefCounted
IsSharedComponentTypeThe component type inherits from ISharedComponentData
IsTemporaryBakingTypeThe component type is decorated with the TemporaryBakingTypeAttribute attribute.
IsTransformThe component type is a transform type
IsZeroSizedThe component type allocates 0 bytes in Chunk storage

Static Properties

Property

Description

NullAn invalid TypeIndex which does not map to a valid component type.

Methods

Method

Description

CompareToCompare this TypeIndex against a given one
EqualsTypeIndex instances are equal if they refer to the same component type instance.
GetHashCodeA hash used for comparisons.
ToFixedStringProvides a Burst compatible debugging string.
ToStringProvides a debugging string.

Operators

Operator

Description

operator ==TypeIndex instances are equal if they refer to the same component type instance.
operator >Evaluates if one TypeIndex is greater than the other.
operator >=Evaluates if one TypeIndex is greater than or equal to the other.
TypeIndexImplicit conversion from an int to a TypeIndex.
intImplicit conversion from TypeIndex to an int.
operator !=TypeIndex instances are equal if they refer to the same component type instance.
operator <Evaluates if one TypeIndex is less than the other.
operator <=Evaluates if one TypeIndex is less than or equal to the other.