Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

ComponentType

struct in Unity.Entities

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

A struct to define a component including how it's accessed and what type of component it is

Properties

Property Description
AccessModeType The way the component type will be accessed
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
TypeIndex A unique index of the component type

Constructors

Constructor Description
ComponentType Create a component type

Public Methods

Method Description
CompareTo Returns the sort order this component type compared to another
Equals Checks if this component type has the same ComponentType.TypeIndex and ComponentType.AccessModeType as the other 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 generic type T.

Operators

Operator Description
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 AccessMode.
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.