Skip to content

Game.Prefabs.Modes.GameModeInfoData

Assembly: Assembly-CSharp
Namespace: Game.Prefabs.Modes

Type: struct

Base: System.ValueType, IComponentData, IQueryTypeParameter

Summary:
GameModeInfoData is an empty/marker ECS component used to tag entities or prefabs that represent a game mode (or contain mode-related metadata) within the game's DOTS/ECS systems. The struct is annotated with [StructLayout(LayoutKind.Sequential, Size = 1)] to force a non-zero managed size (1 byte), ensuring compatibility with certain ECS operations and avoiding issues with zero-sized types. It implements IComponentData so it can be attached to entities, and IQueryTypeParameter to be usable directly in query type specifications.


Fields

  • This struct declares no instance fields.
    Note: The StructLayout attribute sets the struct's managed size to 1 byte despite the absence of fields.

Properties

  • This struct exposes no properties.

Constructors

  • public GameModeInfoData()
    The default parameterless constructor is the implicit struct constructor (no explicit constructors are declared).

Methods

  • This struct declares no methods. It only implements marker/interface types (IComponentData, IQueryTypeParameter) and has no runtime behavior.

Usage Example

// Mark an existing entity as a game mode entity
entityManager.AddComponentData(entity, new GameModeInfoData());

// Create an entity with the marker component
var archetype = entityManager.CreateArchetype(typeof(GameModeInfoData));
var newEntity = entityManager.CreateEntity(archetype);

// Query for entities that have the marker
EntityQuery query = entityManager.CreateEntityQuery(typeof(GameModeInfoData));
using (var entities = query.ToEntityArray(Allocator.TempJob))
{
    foreach (var e in entities)
    {
        // handle game mode entity 'e'
    }
}

{{ This is a lightweight marker component used by modders to identify or filter game mode prefabs/entities in ECS systems. Common uses: - Tagging mode prefabs so systems can find and initialize them. - Using in EntityQuery/Systems to run logic only for mode-related entities. - The explicit Size = 1 layout ensures the component is non-zero-sized and avoids potential engine/serialization edge cases with truly empty structs. }}