Game.Tutorials.UpgradeTriggerData
Assembly: Assembly-CSharp
Namespace: Game.Tutorials
Type: struct
Base: System.ValueType (implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter)
Summary:
UpgradeTriggerData is an empty marker/tag ECS component used by the game's tutorial system to mark entities that should trigger an "upgrade" tutorial step. The struct is explicitly given a non-zero size via [StructLayout(Sequential, Size = 1)] so it behaves as a small, non-zero-sized component (useful for certain chunk/layout/interop expectations) while carrying no payload data. As a tag component it is meant only for identification in EntityQueries or adding/removing state; it stores no data.
Fields
- This type declares no instance fields.
UpgradeTriggerData is an empty/tag component; its layout attribute only affects its memory size, not fields.
Properties
- This type declares no properties.
Use this type in queries or as a marker on entities rather than to access data through properties.
Constructors
public UpgradeTriggerData()
This is the implicit default parameterless constructor for the struct. No initialization is required because the component has no data.
Methods
- This type declares no methods. It is purely a marker type implementing IComponentData and IQueryTypeParameter.
Remarks (additional information)
- The attribute [StructLayout(LayoutKind.Sequential, Size = 1)] forces the runtime size to 1 byte. This prevents it from being treated as a zero-sized component (ZSC) which can have different semantics in some tooling, serialization, or when interoperating with native code.
- Implements IQueryTypeParameter so it can be used directly in query/filter APIs (e.g., WithAll
). - Use this component to add/remove a tutorial trigger flag on an entity, or to select entities that should cause the upgrade tutorial to run.
Usage Example
// Create an entity with the tag
var archetype = EntityManager.CreateArchetype(typeof(Game.Tutorials.UpgradeTriggerData));
var entity = EntityManager.CreateEntity(archetype);
// Or add the tag to an existing entity
EntityManager.AddComponent<Game.Tutorials.UpgradeTriggerData>(existingEntity);
// Query for entities that have the upgrade trigger tag (inside a SystemBase)
Entities
.WithAll<Game.Tutorials.UpgradeTriggerData>()
.ForEach((Entity e) =>
{
// handle upgrade tutorial trigger for entity e
// optionally remove the tag when handled:
EntityManager.RemoveComponent<Game.Tutorials.UpgradeTriggerData>(e);
}).WithoutBurst().Run();