Skip to content

Game.Unspawned

Assembly:
Assembly-CSharp (typical for game mods)
Namespace: Game.Objects

Type:
struct

Base:
System.ValueType

Summary:
Unspawned is a marker component (an empty struct) used with Unity's ECS in Cities: Skylines 2 modding. It implements IComponentData so it can be attached to entities, IQueryTypeParameter so it can be used in Entities queries, and IEmptySerializable to support the Colossal.Serialization system. The StructLayout attribute with Size = 1 ensures the type has a non-zero marshalled size (useful for serialization/interop).


Fields

  • This struct declares no instance fields.
    It is intentionally empty; the StructLayout(Size = 1) attribute is applied to ensure a 1-byte layout for serialization/marshalling.

Properties

  • This struct exposes no properties.

Constructors

  • There is no explicit constructor declared.
    As a value type, it has the default parameterless constructor provided by the runtime.

Methods

  • No methods are declared on this struct.

Usage Example

using Unity.Entities;
using Game.Objects;

// Add the marker to an entity
EntityManager em = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity e = em.CreateEntity();
em.AddComponentData(e, new Unspawned());

// Query for all unspawned entities in a system
Entities
    .WithAll<Unspawned>()
    .ForEach((Entity ent) =>
    {
        // handle unspawned entity
    })
    .Schedule();

Additional notes: - Implemented interfaces: IComponentData, IQueryTypeParameter, IEmptySerializable. - Attribute: [StructLayout(LayoutKind.Sequential, Size = 1)] — ensures a 1-byte layout for interop/serialization.