Skip to content

Game.Areas.Space

Assembly: Game
Namespace: Game.Areas

Type: struct

Base: System.ValueType
Implements: IComponentData, IQueryTypeParameter, IEmptySerializable

Summary:
Space is an empty (tag) ECS component used to mark entities related to "space" areas. The struct is annotated with [StructLayout(LayoutKind.Sequential, Size = 1)] to ensure it has a non-zero size for serialization and interop. It implements IComponentData so it can be used in Unity's ECS, IQueryTypeParameter so it can be used directly in query descriptions, and IEmptySerializable to integrate with Colossal's serialization system.


Fields

  • This type declares no instance fields.
    Although empty, it is given a fixed layout size (1 byte) via the StructLayout attribute to satisfy serialization/interop requirements.

Properties

  • This type declares no properties.

Constructors

  • public Space() (implicit)
    As a value type (struct), Space uses the implicit parameterless/default constructor provided by C#. No explicit constructors are defined.

Methods

  • This type declares no methods.

Usage Example

using Unity.Entities;
using Game.Areas;

// Add the Space tag to an entity
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = entityManager.CreateEntity();
entityManager.AddComponentData(entity, new Space()); // or entityManager.AddComponent<Space>(entity);

// Check for the tag
bool hasSpace = entityManager.HasComponent<Space>(entity);

// Remove the tag
entityManager.RemoveComponent<Space>(entity);

// Querying entities that have the Space tag in a SystemBase
public partial class SpaceProcessingSystem : SystemBase
{
    protected override void OnUpdate()
    {
        Entities.WithAll<Space>().ForEach((Entity e) =>
        {
            // Process entities tagged with Space
        }).Run();
    }
}

{{ This empty, 1-byte-sized tag component is intended for marking/identifying entities in ECS queries and serialization. Use it as a marker in systems and entity archetypes to represent "space" areas without carrying additional per-entity data. }}