Game.EventAchievement
Assembly: Assembly-CSharp
Namespace: Game.Achievements
Type: struct
Base: System.ValueType (implements IComponentData, IQueryTypeParameter)
Summary: EventAchievement is a marker component (zero-data tag) used by the game's ECS to mark entities that represent an achievement triggered by an in-game event. It carries no payload fields; the presence of the component on an entity is used to identify or filter those entities in systems and queries. The type is explicitly given a size of 1 byte via StructLayout to avoid issues with zero-sized components in the ECS runtime.
Fields
- (none)
This struct defines no instance fields. It is a marker/flag component. The StructLayout attribute ([StructLayout(LayoutKind.Sequential, Size = 1)]) forces the struct to occupy 1 byte so it is not considered a zero-sized component by native code or tooling that expects a non-zero size.
Properties
- (none)
There are no properties; the component exists only as a tag.
Constructors
public EventAchievement()
Structs in C# get a default parameterless constructor provided by the runtime. Because this type holds no data, the default instance is used when adding the component to entities (or you can passnew EventAchievement()
which is equivalent).
Methods
- (none)
There are no methods defined on this component type.
Usage Example
using Unity.Entities;
using Game.Achievements;
// Add the marker component when creating an entity
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity e = entityManager.CreateEntity(typeof(EventAchievement));
// Or add the component to an existing entity
entityManager.AddComponentData(e, new EventAchievement());
// Query systems can filter by the presence of the marker
Entities
.WithAll<EventAchievement>()
.ForEach((Entity ent) =>
{
// handle achievement event entity
}).Schedule();
Notes: - The component implements IComponentData so it is a pure ECS component (component data) usable with Unity's Entities API. - The IQueryTypeParameter implementation indicates the type can be used directly in query parameter contexts (used by some query-building utilities and system patterns). - Because the component carries no state, it is intended purely for identification/triggering logic in systems (e.g., creating, processing, and removing achievement entities).