ComponentType
A struct to define a component including how it's accessed and what type of component it is
Read time 3 minutesLast updated 2 days ago
Definition
- Type: Struct
- Namespace: Unity.Entities
- Assembly: UnityEngine.EntitiesModule
- Implements: IEquatable<ComponentType>, IComparable<ComponentType>
public struct ComponentType : IEquatable<ComponentType>, IComparable<ComponentType>
Fields
Value | Description |
|---|---|
| AccessModeType | The way the component type will be accessed |
| TypeIndex | A unique index of the component type |
Constructors
Constructor | Description |
|---|---|
| ComponentType(System.Type,Unity.Entities.ComponentType.AccessMode) | Create a component type |
Properties
Property | Description |
|---|---|
| HasEntityReferences | True if any of the fields in the component type are type Entity |
| HasNativeContainer | The component type contains a NativeContainerAttribute decorated member. NativeContainer members found in nested member types will also cause this property to return true. |
| IsBuffer | True if the component type is a IBufferElementData |
| IsChunkComponent | True if the component type is flagged as a chunk component type |
| IsChunkSerializable | True if the component type is appropriate for chunk serialization. Such types are blittable without containing pointer types or have been decorated with ChunkSerializableAttribute. |
| IsCleanupBufferComponent | Bitflag set for component types inheriting from ICleanupBufferElementData. |
| IsCleanupComponent | True if the component type is a ICleanupComponentData |
| IsCleanupSharedComponent | True if the component type is a ICleanupSharedComponentData |
| IsComponent | True if the component type is a IComponentData |
| IsEnableable | True if the component type is a IEnableableComponent |
| IsSharedComponent | True if the component type is a ISharedComponentData |
| IsZeroSized | True if the component type does not contain actual fields or data |
Methods
Method | Description |
|---|---|
| CompareTo | Returns the sort order this component type compared to another |
| Equals | Checks to see if an object is equal to this component type. |
| GetHashCode | A hash used for comparisons. |
| GetManagedType | Gets the managed Type based on the component's ComponentType.TypeIndex. |
| ToFixedString | Returns a fixed string of the component type |
| ToString | Returns a managed string of the component type |
Static Methods
Method | Description |
|---|---|
| ChunkComponent | Returns a ComponentType that is a chunk component with ComponentType.AccessMode.ReadWrite based on the type. |
| ChunkComponentExclude | Returns a ComponentType that is a chunk component with ComponentType.AccessMode.Exclude based on the type. |
| ChunkComponentReadOnly | Returns a ComponentType that is a chunk component with ComponentType.AccessMode.ReadOnly based on the type. |
| Combine | Combine multiple array of component type into one. Duplicate types are removed. It will allocate an array containing all component type. Useful for creating queries during initialization of systems. |
| Exclude | Returns a ComponentType with ComponentType.AccessMode.Exclude based on the type. |
| FromTypeIndex | Returns a ComponentType with ComponentType.AccessMode.ReadWrite based on the typeIndex |
| ReadOnly | Returns a ComponentType with ComponentType.AccessMode.ReadOnly based on the type. |
| ReadWrite | Returns a ComponentType with ComponentType.AccessMode.ReadWrite based on the type. |
Operators
Operator | Description |
|---|---|
| operator == | Evaluates if two component types are equal based on ComponentType.TypeIndex and ComponentType.AccessModeType. |
| operator > | Evaluates if one component type is greater than the the other. |
| ComponentType | Creates a new component type based on the type passed in |
| operator != | Evaluates if two component types are not equal based on ComponentType.TypeIndex and ComponentType.AccessModeType. |
| operator < | Evaluates if one component type is less than the the other first by ComponentType.TypeIndex, then by ComponentType.AccessMode. |
Enums
Enum | Description |
|---|---|
| ComponentType.AccessMode | The access of the component type |