# 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.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule
* **Implements:** [IComparable\<TypeIndex>](https://learn.microsoft.com/dotnet/api/system.icomparable-1), [IEquatable\<TypeIndex>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

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

## Fields

| Value                                                                      | Description                                            |
| -------------------------------------------------------------------------- | ------------------------------------------------------ |
| [Value](/engine/7000.0/script-reference/unity/entities/typeindex/value.md) | Raw value used to identify Component types at runtime. |

## Properties

| Property                                                                                                         | Description                                                                                                                                                                                                                                                  |
| ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Flags](/engine/7000.0/script-reference/unity/entities/typeindex/flags.md)                                       | Type flags stored in Value                                                                                                                                                                                                                                   |
| [HasEntityReferences](/engine/7000.0/script-reference/unity/entities/typeindex/hasentityreferences.md)           | The component type contains an [Entity](/engine/7000.0/script-reference/unity/entities/entity.md) member. Entity members found in nested member types will also cause this property to return true.                                                          |
| [HasNativeContainer](/engine/7000.0/script-reference/unity/entities/typeindex/hasnativecontainer.md)             | The component type contains a NativeContainerAttribute decorated member. NativeContainer members found in nested member types will also cause this property to return true.                                                                                  |
| [HasOnAddedCallback](/engine/7000.0/script-reference/unity/entities/typeindex/hasonaddedcallback.md)             | The component type has an OnAddedCallback.                                                                                                                                                                                                                   |
| [HasOnRemovedCallback](/engine/7000.0/script-reference/unity/entities/typeindex/hasonremovedcallback.md)         | The component type has an OnRemovedCallback.                                                                                                                                                                                                                 |
| [Index](/engine/7000.0/script-reference/unity/entities/typeindex/index.md)                                       | Zero-based index for the [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) stored in Value (the type index with no flags).                                                                                                            |
| [IsBakingOnlyType](/engine/7000.0/script-reference/unity/entities/typeindex/isbakingonlytype.md)                 | The component type is decorated with the [BakingTypeAttribute](/engine/7000.0/script-reference/unity/entities/bakingtypeattribute.md) attribute.                                                                                                             |
| [IsBuffer](/engine/7000.0/script-reference/unity/entities/typeindex/isbuffer.md)                                 | The component type inherits from [IBufferElementData](/engine/7000.0/script-reference/unity/entities/ibufferelementdata.md)                                                                                                                                  |
| [IsChunkComponent](/engine/7000.0/script-reference/unity/entities/typeindex/ischunkcomponent.md)                 | The component type is used as a chunk component (a component mapped to a Chunk rather than [Entity](/engine/7000.0/script-reference/unity/entities/entity.md))                                                                                               |
| [IsChunkSerializable](/engine/7000.0/script-reference/unity/entities/typeindex/ischunkserializable.md)           | The component type is appropriate for chunk serialization. Such types are blittable without containing pointer types or have been decorated with [ChunkSerializableAttribute](/engine/7000.0/script-reference/unity/entities/chunkserializableattribute.md). |
| [IsCleanupBufferComponent](/engine/7000.0/script-reference/unity/entities/typeindex/iscleanupbuffercomponent.md) | The component type inherits from [ICleanupBufferElementData](/engine/7000.0/script-reference/unity/entities/icleanupbufferelementdata.md)                                                                                                                    |
| [IsCleanupComponent](/engine/7000.0/script-reference/unity/entities/typeindex/iscleanupcomponent.md)             | The component type inherits from [ICleanupComponentData](/engine/7000.0/script-reference/unity/entities/icleanupcomponentdata.md)                                                                                                                            |
| [IsCleanupSharedComponent](/engine/7000.0/script-reference/unity/entities/typeindex/iscleanupsharedcomponent.md) | The component type inherits from [ICleanupSharedComponentData](/engine/7000.0/script-reference/unity/entities/icleanupsharedcomponentdata.md)                                                                                                                |
| [IsComponentType](/engine/7000.0/script-reference/unity/entities/typeindex/iscomponenttype.md)                   | The component type inherits from [IComponentData](/engine/7000.0/script-reference/unity/entities/icomponentdata.md)                                                                                                                                          |
| [IsEnableable](/engine/7000.0/script-reference/unity/entities/typeindex/isenableable.md)                         | The component type inherits from [IEnableableComponent](/engine/7000.0/script-reference/unity/entities/ienableablecomponent.md)                                                                                                                              |
| [IsIEquatable](/engine/7000.0/script-reference/unity/entities/typeindex/isiequatable.md)                         | The component type inherits from IEquatable\_1                                                                                                                                                                                                               |
| [IsRefCounted](/engine/7000.0/script-reference/unity/entities/typeindex/isrefcounted.md)                         | The component type inherits from [IRefCounted](/engine/7000.0/script-reference/unity/entities/irefcounted.md)                                                                                                                                                |
| [IsSharedComponentType](/engine/7000.0/script-reference/unity/entities/typeindex/issharedcomponenttype.md)       | The component type inherits from [ISharedComponentData](/engine/7000.0/script-reference/unity/entities/isharedcomponentdata.md)                                                                                                                              |
| [IsTemporaryBakingType](/engine/7000.0/script-reference/unity/entities/typeindex/istemporarybakingtype.md)       | The component type is decorated with the [TemporaryBakingTypeAttribute](/engine/7000.0/script-reference/unity/entities/temporarybakingtypeattribute.md) attribute.                                                                                           |
| [IsTransform](/engine/7000.0/script-reference/unity/entities/typeindex/istransform.md)                           | The component type is a transform type                                                                                                                                                                                                                       |
| [IsZeroSized](/engine/7000.0/script-reference/unity/entities/typeindex/iszerosized.md)                           | The component type allocates 0 bytes in Chunk storage                                                                                                                                                                                                        |

## Static Properties

| Property                                                                 | Description                                                                                                                       |
| ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------- |
| [Null](/engine/7000.0/script-reference/unity/entities/typeindex/null.md) | An invalid [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) which does not map to a valid component type. |

## Methods

| Method                                                                                     | Description                                                                                                                                     |
| ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| [CompareTo](/engine/7000.0/script-reference/unity/entities/typeindex/compareto.md)         | Compare this [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) against a given one                                       |
| [Equals](/engine/7000.0/script-reference/unity/entities/typeindex/equals.md)               | [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) instances are equal if they refer to the same component type instance. |
| [GetHashCode](/engine/7000.0/script-reference/unity/entities/typeindex/gethashcode.md)     | A hash used for comparisons.                                                                                                                    |
| [ToFixedString](/engine/7000.0/script-reference/unity/entities/typeindex/tofixedstring.md) | Provides a Burst compatible debugging string.                                                                                                   |
| [ToString](/engine/7000.0/script-reference/unity/entities/typeindex/tostring.md)           | Provides a debugging string.                                                                                                                    |

## Operators

| Operator                                                                                         | Description                                                                                                                                     |
| ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| [operator ==](/engine/7000.0/script-reference/unity/entities/typeindex/op-equality.md)           | [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) instances are equal if they refer to the same component type instance. |
| [operator >](/engine/7000.0/script-reference/unity/entities/typeindex/op-greaterthan.md)         | Evaluates if one [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) is greater than the other.                            |
| [operator >=](/engine/7000.0/script-reference/unity/entities/typeindex/op-greaterthanorequal.md) | Evaluates if one [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) is greater than or equal to the other.                |
| [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex/op-implicit.md)             | Implicit conversion from an int to a TypeIndex.                                                                                                 |
| [int](/engine/7000.0/script-reference/unity/entities/typeindex/op-implicit.md)                   | Implicit conversion from TypeIndex to an int.                                                                                                   |
| [operator !=](/engine/7000.0/script-reference/unity/entities/typeindex/op-inequality.md)         | [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) instances are equal if they refer to the same component type instance. |
| [operator \<](/engine/7000.0/script-reference/unity/entities/typeindex/op-lessthan.md)           | Evaluates if one [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) is less than the other.                               |
| [operator \<=](/engine/7000.0/script-reference/unity/entities/typeindex/op-lessthanorequal.md)   | Evaluates if one [TypeIndex](/engine/7000.0/script-reference/unity/entities/typeindex.md) is less than or equal to the other.                   |
