Aspect concepts
An aspect is an object-like wrapper that you can use to group together a subset of an entity's components into a single C# struct. Aspects are useful for organizing component code and simplifying queries in your systems. Unity provides predefined aspects for groups of related components or you can define your own with the IAspect
interface.
Aspects can include items such as the following:
- A single
Entity
field to store the entity's ID RefRW<T>
andRefRO<T>
fields to access component data of typeT
, whereT
implementsIComponentData
.EnabledRefRW
andEnabledRefRO
fields to access the enabled state of components that implementIEnableableComponent
.DynamicBuffer<T>
fields to access the buffer elements that implementIBufferElementData
- Any
ISharedComponent
fields to access the shared component value as read-only. - Other aspect types