Game.Tutorials.TriggerActive
Assembly: Assembly-CSharp
Namespace: Game.Tutorials
Type: struct
Base: System.ValueType, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
TriggerActive is an empty/tag ECS component used to mark tutorial trigger entities as "active". The struct is attributed with [StructLayout(LayoutKind.Sequential, Size = 1)] to give it a non-zero, deterministic native size and layout (useful for interop, native queries and to avoid zero-size component corner cases). As a tag component it carries no data — its presence/absence on an entity is the signal. It implements IComponentData so it can be added to entities and IQueryTypeParameter so it can be used in query type parameters.
Fields
- (none)
This struct contains no instance fields — it is a pure marker/tag component. The explicit StructLayout(Size = 1) ensures it still occupies one byte in native memory.
Properties
- (none)
No properties are defined.
Constructors
- (implicit) public TriggerActive()
Being a value type, a default parameterless constructor exists implicitly. No explicit constructors are declared.
Methods
- (none)
No methods are defined on this struct.
Usage Example
// Add the tag to an entity
entityManager.AddComponentData(entity, new TriggerActive());
// Remove the tag from an entity
entityManager.RemoveComponent<TriggerActive>(entity);
// Create an entity archetype that includes the tag
var archetype = entityManager.CreateArchetype(typeof(TriggerActive), typeof(SomeOtherComponent));
var e = entityManager.CreateEntity(archetype);
// Query entities that have the tag in a SystemBase
protected override void OnUpdate()
{
Entities
.WithAll<TriggerActive>()
.ForEach((Entity ent, in SomeOtherComponent comp) =>
{
// Handle active tutorial trigger
})
.Schedule();
}
Additional notes: - Use this component as a lightweight marker to drive tutorial-related behavior (activation, progression, visibility, etc.). - Because it is a tag (no payload), add/remove operations are used to toggle state rather than setting fields.