Skip to content

Game.Areas.MapTile

Assembly: Game
Namespace: Game.Areas

Type: struct MapTile

Base: IComponentData, IQueryTypeParameter, IEmptySerializable

Summary:
MapTile is an empty/tag ECS component used to mark entities that represent map tiles. It is decorated with [StructLayout(LayoutKind.Sequential, Size = 1)] so the struct has a non-zero size for native interop and custom serialization. Implementing IComponentData makes it a Unity Entities component, IQueryTypeParameter allows it to be used directly in queries (e.g., WithAll()), and IEmptySerializable indicates to the Colossal.Serialization system that the component is an empty serializable marker (presence/absence is what matters, not payload).


Fields

  • None — this struct declares no instance fields. It is intentionally empty and used purely as a tag/marker component.

Notes: - The StructLayout(Size = 1) attribute ensures the type has size for interop/serialization even though it contains no data.

Properties

  • None — there are no properties on this type.

Constructors

  • public MapTile() (implicit default struct constructor)
    This type relies on the implicit parameterless constructor provided by C# for structs. You generally create it via new MapTile() or by specifying the type when creating an entity.

Methods

  • None — there are no methods defined on this type.

Usage Example

// Create an entity that represents a map tile
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var archetype = entityManager.CreateArchetype(typeof(MapTile), typeof(SomeOtherComponent));
var tileEntity = entityManager.CreateEntity(archetype);

// Or add the tag to an existing entity
entityManager.AddComponentData(existingEntity, new MapTile());

// Querying for entities that are map tiles in a SystemBase
Entities
    .WithAll<MapTile>()
    .ForEach((Entity e, in SomeOtherComponent comp) =>
    {
        // Process map tile entity
    }).Schedule();

Additional Notes: - Because MapTile carries no data, systems should use its presence or absence to drive behavior (filtering, grouping, lifecycle) rather than expecting stored values. - As an IEmptySerializable type used by the game's serializer, MapTile presence will be preserved across save/load as a marker component.