Game.Tutorials.TutorialPhaseCompleted
Assembly: Assembly-CSharp
Namespace: Game.Tutorials
Type: struct
Base: System.ValueType, IComponentData, IQueryTypeParameter
Summary:
A marker/tag component (empty struct) used by the ECS to indicate that a given tutorial phase has been completed for an entity. The struct is laid out with a specific size (1 byte) to be minimal in memory, making it suitable as a lightweight tag component for queries and component checks in systems.
Fields
- This struct defines no instance fields. It is an empty/tag component implemented as a struct with an explicit size.
Properties
- This struct defines no properties.
Constructors
public TutorialPhaseCompleted()
The struct has no explicit constructors; it uses the implicit default parameterless constructor provided by C#. As a tag component, it carries no data.
Methods
- This struct defines no methods. Its behavior is solely defined by being present or absent on an entity.
Additional notes:
- The attribute [StructLayout(LayoutKind.Sequential, Size = 1)]
ensures a minimal memory footprint (1 byte) and a predictable layout, which is commonly used for tag components to reduce memory overhead.
- Implements IComponentData to be usable as a Unity.Entities component and IQueryTypeParameter to be usable directly in query type parameters in some ECS APIs.
Usage Example
// Mark an entity as having completed the tutorial phase
entityManager.AddComponent<TutorialPhaseCompleted>(entity);
// Or, using an EntityCommandBuffer inside a system:
ecb.AddComponent<TutorialPhaseCompleted>(entity);
// Query entities that have completed the tutorial phase
Entities
.WithAll<TutorialPhaseCompleted>()
.ForEach((Entity entity) =>
{
// handle completed tutorial phase
}).Run();