Skip to content

Game.Prefabs.MapTileData

Assembly: (project source — not specified in file)
Namespace: Game.Prefabs

Type: struct

Base: IComponentData, IQueryTypeParameter, IEmptySerializable

Summary:
MapTileData is an intentionally empty marker component used in the ECS (Unity.Entities) context. It is annotated with [StructLayout(LayoutKind.Sequential, Size = 1)] to give it a non-zero size (1 byte) to avoid edge cases with zero-sized types and to support serialization. Implementing IComponentData makes it usable as a component on entities, IQueryTypeParameter allows it to be used directly in query type parameters, and IEmptySerializable flags it for (de)serialization as an empty type. This struct contains no data — it functions purely as a tag/marker.


Fields

  • This type defines no instance fields.
    MapTileData is an empty/tag component; its layout attribute forces a 1-byte size but there are no declared fields.

Properties

  • This type defines no properties.

Constructors

  • public MapTileData() (implicit)
    Being a struct, it has the default parameterless constructor provided by C#. No explicit constructors are declared in source.

Methods

  • This type declares no methods.

Usage Example

// Add MapTileData as a tag to a newly created entity
var em = Unity.Entities.World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = em.CreateEntity();
em.AddComponent<MapTileData>(entity);

// Create a query for all entities that have the MapTileData tag
var query = em.CreateEntityQuery(ComponentType.ReadOnly<MapTileData>());

// Use in a SystemBase job (example: operate on entities that have MapTileData)
public partial class ExampleSystem : Unity.Entities.SystemBase
{
    protected override void OnUpdate()
    {
        Entities
            .WithAll<MapTileData>()
            .ForEach((Entity e) =>
            {
                // Body runs for entities tagged with MapTileData
            }).Schedule();
    }
}