Skip to content

Game.Prefabs.Climate.SeasonData

Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs.Climate

Type: struct

Base: IComponentData, IQueryTypeParameter

Summary:
SeasonData is an empty/tag component (value type) used by the game's ECS to mark entities/prefabs that are associated with seasonal or climate-related behavior. The struct is explicitly given a non-zero size via StructLayout(LayoutKind.Sequential, Size = 1) so it can be used safely with native/marshalling APIs and the Unity Entities runtime (avoiding zero-sized-type edge cases). Because it implements IComponentData, it can be added as a component to entities; implementing IQueryTypeParameter makes it convenient to use in queries and WithAll/WithNone style filters.


Fields

  • None
    This struct declares no instance fields. The attribute StructLayout(..., Size = 1) ensures the type occupies at least one byte despite having no fields.

Properties

  • None
    There are no properties defined on this type.

Constructors

  • public SeasonData()
    The parameterless constructor is the default, compiler-provided constructor for the value type. No custom construction logic is defined.

Methods

  • None
    The type does not define any methods. It only serves as a marker component and implements IComponentData and IQueryTypeParameter (both marker-style interfaces here), so there are no interface method implementations to provide.

Usage Example

// Add the marker component to an entity (EntityManager API)
entityManager.AddComponentData(entity, new SeasonData());

// Querying entities that have the SeasonData marker (SystemBase / Entities.ForEach)
protected override void OnUpdate()
{
    Entities
        .WithAll<SeasonData>()
        .ForEach((Entity entity) =>
        {
            // Handle seasonal-specific logic for marked entities
        }).Schedule();
}

// Alternatively, remove the marker to stop treating an entity as season-related
entityManager.RemoveComponent<SeasonData>(entity);

Notes: - Because SeasonData is an empty/tag component, it's typically used only to categorize entities for systems (e.g., "apply seasonal changes to all entities that have SeasonData") rather than to store per-entity values. - The explicit Size = 1 in the StructLayout attribute prevents the struct from being a zero-sized type, which improves compatibility with low-level APIs and avoids certain ECS/runtime constraints.