Documentation

Unity Engine


Unity Engine


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

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

Fields

Value

Description

AccessModeTypeThe way the component type will be accessed
TypeIndexA unique index of the component type

Constructors

Constructor

Description

ComponentType(System.Type,Unity.Entities.ComponentType.AccessMode)Create a component type

Properties

Property

Description

HasEntityReferencesTrue if any of the fields in the component type are type Entity
HasNativeContainerThe component type contains a NativeContainerAttribute decorated member. NativeContainer members found in nested member types will also cause this property to return true.
IsBufferTrue if the component type is a IBufferElementData
IsChunkComponentTrue if the component type is flagged as a chunk component type
IsChunkSerializableTrue if the component type is appropriate for chunk serialization. Such types are blittable without containing pointer types or have been decorated with ChunkSerializableAttribute.
IsCleanupBufferComponentBitflag set for component types inheriting from ICleanupBufferElementData.
IsCleanupComponentTrue if the component type is a ICleanupComponentData
IsCleanupSharedComponentTrue if the component type is a ICleanupSharedComponentData
IsComponentTrue if the component type is a IComponentData
IsEnableableTrue if the component type is a IEnableableComponent
IsSharedComponentTrue if the component type is a ISharedComponentData
IsZeroSizedTrue if the component type does not contain actual fields or data

Methods

Method

Description

CompareToReturns the sort order this component type compared to another
EqualsChecks to see if an object is equal to this component type.
GetHashCodeA hash used for comparisons.
GetManagedTypeGets the managed Type based on the component's ComponentType.TypeIndex.
ToFixedStringReturns a fixed string of the component type
ToStringReturns a managed string of the component type

Static Methods

Method

Description

ChunkComponentReturns a ComponentType that is a chunk component with ComponentType.AccessMode.ReadWrite based on the type.
ChunkComponentExcludeReturns a ComponentType that is a chunk component with ComponentType.AccessMode.Exclude based on the type.
ChunkComponentReadOnlyReturns a ComponentType that is a chunk component with ComponentType.AccessMode.ReadOnly based on the type.
CombineCombine 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.
ExcludeReturns a ComponentType with ComponentType.AccessMode.Exclude based on the type.
FromTypeIndexReturns a ComponentType with ComponentType.AccessMode.ReadWrite based on the typeIndex
ReadOnlyReturns a ComponentType with ComponentType.AccessMode.ReadOnly based on the type.
ReadWriteReturns 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.
ComponentTypeCreates 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.AccessModeThe access of the component type