Skip to content

Game.Events.CalendarEvent

Assembly: Assembly-CSharp
{{ This type is defined in the game's runtime assembly (commonly Assembly-CSharp for Unity projects). If you have a mod-specific assembly, reference that assembly name instead. }}

Namespace: Game.Events {{ Placed under the Game.Events namespace. }}

Type: struct {{ A value type used as an ECS component/tag. }}

Base: System.ValueType (implements Colossal/Unity ECS interfaces) {{ CalendarEvent is a plain value-type (struct). It implements IComponentData (Unity.Entities) to act as an ECS component, IQueryTypeParameter to be usable in query/filter APIs, and IEmptySerializable to participate in the game's/custom Colossal serialization pipeline. }}

Summary: {{ CalendarEvent is an intentionally empty "tag" or marker component used within the ECS to mark entities that are associated with calendar-related events. The struct has no instance data, but is explicitly given a size of 1 byte via StructLayout to ensure predictable memory/serialization behavior. It's used for queries, filters, and marking entities rather than holding state. }}


Fields

  • None {{ This struct declares no fields. The attribute [StructLayout(LayoutKind.Sequential, Size = 1)] forces a 1-byte size even though there are no members; this is often done so the type can be serialized/stored by systems that require a non-zero sized type. }}

Properties

  • None {{ No properties are defined — CalendarEvent is a pure marker component. }}

Constructors

  • implicit default constructor {{ No explicit constructors are defined. As a struct it has the default parameterless constructor provided by C#. The struct is effectively an empty tag with a forced size. }}

Methods

  • None {{ The type does not define methods. Its behavior depends on the systems/systems code that check for or add this component to entities. }}

Usage Example

// Add the tag to an entity
var entity = entityManager.CreateEntity();
entityManager.AddComponent<CalendarEvent>(entity);

// Use it in a query or job setup (example pseudo-code using Entities API)
Entities.WithAll<CalendarEvent>().ForEach((Entity e) =>
{
    // Handle entities that are marked with CalendarEvent
}).Schedule();

// Alternatively, create an entity archetype that includes the tag
var archetype = entityManager.CreateArchetype(typeof(CalendarEvent), typeof(SomeOtherComponent));
var taggedEntity = entityManager.CreateEntity(archetype);

{{ Because CalendarEvent carries no data, it's typically used as a marker for filtering/identifying entities in queries or for signaling systems to run logic for those entities. The IEmptySerializable and explicit Size attribute ensure compatibility with the game's/custom serialization and memory expectations. }}