Skip to content

Game.EarlyDisasterWarningEventData

Assembly: Assembly-CSharp (likely)
Namespace: Game.Prefabs

Type: struct

Base: System.ValueType
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
EarlyDisasterWarningEventData is an empty (tag) component type used as a marker/event to indicate an "early disaster warning" in game logic. It is a zero-data component (ZST) declared with a StructLayout of Size = 1 to ensure a non-zero managed size for interop and runtime stability. As an IComponentData it can be attached to entities; as an IQueryTypeParameter it is intended to be used in queries and systems as a filter/marker type.


Fields

  • (none)
    This struct intentionally contains no user-visible instance fields; it functions as a marker/flag component.

Properties

  • (none)
    There are no properties on this type.

Constructors

  • public EarlyDisasterWarningEventData()
    Default parameterless struct constructor (implicit). Use the default value to add the marker to an entity.

Methods

  • (none)
    This type exposes no methods. Its behavior is determined by systems that read/add/remove the component.

Usage Example

// Add the marker component to an entity to signal an early disaster warning
entityManager.AddComponentData(entity, new EarlyDisasterWarningEventData());

// Example SystemBase usage: process all entities that currently have the marker
public partial class EarlyDisasterWarningSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // Query for entities that have the marker (IQueryTypeParameter allows this usage in some query APIs)
        Entities
            .WithName("HandleEarlyDisasterWarnings")
            .WithAll<EarlyDisasterWarningEventData>()
            .ForEach((Entity e, int entityInQueryIndex /* other components here */) =>
            {
                // Handle warning (e.g., trigger UI, start disaster logic)
                // After handling, remove the marker to mark the event as consumed:
                EntityManager.RemoveComponent<EarlyDisasterWarningEventData>(e);
            }).Schedule();
    }
}

Notes: - The StructLayout(Size = 1) attribute ensures the struct has a non-zero size at the binary/interop level while remaining semantically empty in ECS usage. - This type is intended to be used as a transient event/marker; systems commonly add it to an entity for one frame or until processed, then remove it.