Skip to content

Game.Prefabs.CharacterOverlayData

Assembly:
Assembly-CSharp (game runtime assembly; may vary by build)

Namespace:
Game.Prefabs

Type:
struct

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

Summary:
A lightweight tag component used to mark entities that should receive a character overlay. The struct is empty by design (no managed fields) and is annotated with [StructLayout(LayoutKind.Sequential, Size = 1)] to force a non-zero size (1 byte) for interop and to avoid zero-sized-type issues with certain runtime or native interop scenarios. This is commonly used as a marker/tag in ECS queries and for batching logic that targets entities representing characters that need overlay rendering or related processing.


Fields

  • This struct defines no instance fields. It is intentionally empty (a tag component) and the layout attribute sets its size to 1 byte for safety in native interop and entity layouts.

Properties

  • This type exposes no properties. It is used purely as a tag component.

Constructors

  • public CharacterOverlayData()
    Default value-type constructor (implicit). The StructLayout attribute ensures the struct occupies 1 byte even when default-constructed.

Methods

  • This struct declares no methods. Its purpose is to act as a marker implementing IComponentData and IQueryTypeParameter for ECS queries and type-safe filtering.

Usage Example

// Add the tag to an entity (immediate, via EntityManager)
entityManager.AddComponent<CharacterOverlayData>(entity);

// Or add it using an EntityCommandBuffer (e.g., from a system/job)
var ecb = new EntityCommandBuffer(Allocator.Temp);
ecb.AddComponent<CharacterOverlayData>(entity);
ecb.Playback(entityManager);
ecb.Dispose();

// Querying entities that have the tag (syntax depends on Entities version)
Entities.WithAll<CharacterOverlayData>().ForEach((Entity e) =>
{
    // process entity with character overlay
}).Schedule();