Game.Citizens.Adult
Assembly: Assembly-CSharp (game runtime)
Namespace: Game.Citizens
Type: struct
Base: System.ValueType, implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable
Summary:
Adult is an empty/tag ECS component used to mark an entity as an adult citizen. It is annotated with [StructLayout(LayoutKind.Sequential, Size = 1)] so it occupies a single byte (avoiding a zero-sized type) and is compatible with the game's serialization system (IEmptySerializable). As a marker component it carries no data and is intended for queries, filters, and conditional logic in Systems and Archetypes.
Fields
- This struct defines no instance fields. It is intentionally empty (used as a tag component).
Properties
- None
Constructors
- public Adult()
This is the default (implicit) parameterless constructor for the struct which yields the default value. No custom constructor logic is provided.
Methods
- None (no methods are defined on this type). It implements the marker/serialization interfaces but provides no custom members.
Usage Example
using Unity.Entities;
using Game.Citizens;
// Add the tag to an entity
EntityManager em = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity e = em.CreateEntity();
em.AddComponentData(e, new Adult());
// Query entities that are adults inside a SystemBase
public partial class ExampleSystem : SystemBase
{
protected override void OnUpdate()
{
Entities
.WithAll<Adult>()
.ForEach((Entity entity) =>
{
// handle adult citizen entity
})
.WithoutBurst()
.Run();
}
}
{{ Notes for modders }}
- Because Adult is an empty tag component, prefer AddComponentData(new Adult()) or AddComponent
- The StructLayout attribute with Size = 1 ensures compatibility with serialization and any native layout expectations in the game's pipeline.