Skip to content

Game.Tools.Warning

Assembly:
Namespace: Game.Tools

Type: struct

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

Summary:
A lightweight "tag" (empty) ECS component used to mark entities with a warning state or flag within the game's entity systems. The struct is attributed with [StructLayout(LayoutKind.Sequential, Size = 1)] to guarantee a non-zero, predictable memory layout (1 byte) so it is blittable and safe to use with Unity's DOTS/ECS systems. As an empty IComponentData, it carries no data and is intended purely for presence/absence checks in queries or to toggle behavior in systems.


Fields

  • This struct declares no instance fields. It is an empty/tag component.

Properties

  • This struct exposes no properties. It implements IComponentData and IQueryTypeParameter so it can be used as a component and as a query parameter in ECS queries.

Constructors

  • public Warning() (implicit)
    The default parameterless constructor is provided implicitly by the C# compiler for value types. No custom constructors are defined.

Methods

  • No instance or static methods are defined on this type. It relies on ECS systems and APIs for behavior (e.g., AddComponentData, RemoveComponent, WithAll(), etc.).

Usage Example

// Add the Warning tag to an entity
entityManager.AddComponentData(entity, new Game.Tools.Warning());

// Remove the Warning tag
entityManager.RemoveComponent<Game.Tools.Warning>(entity);

// Query for entities that have the Warning tag inside a SystemBase
protected override void OnUpdate()
{
    Entities
        .WithAll<Game.Tools.Warning>()
        .ForEach((Entity entity, in SomeOtherComponent comp) =>
        {
            // Handle entities marked with Warning
        }).Schedule();
}