Skip to content

Game.Objects.OutsideConnection

Assembly: Game
Namespace: Game.Objects

Type: struct

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

Summary:
OutsideConnection is an intentionally empty/tag ECS component used to mark entities that represent connections to the outside (for example external road/rail/ship/air connections). The struct is given an explicit memory layout ([StructLayout(LayoutKind.Sequential, Size = 1)]) so it occupies 1 byte rather than being a zero-sized type, which simplifies storage/serialization and interoperability with Colossal's serialization systems. It is used purely as a marker for queries, archetypes, and serialization; it contains no instance data.


Fields

  • (none)
    This struct contains no instance fields. The StructLayout attribute sets Size = 1 so the type occupies one byte in memory/storage despite being an empty marker.

Properties

  • (none)
    No properties are defined.

Constructors

  • public OutsideConnection()
    The default parameterless value-type constructor is used. No custom constructor logic is provided.

Methods

  • (none)
    No methods are declared on this type.

Usage Example

// Create an archetype that includes the OutsideConnection tag
var archetype = World.DefaultGameObjectInjectionWorld.EntityManager.CreateArchetype(
    typeof(Game.Objects.OutsideConnection),
    typeof(SomeOtherComponent) // other components you need
);

// Create an entity from the archetype (it will have the OutsideConnection tag)
var entity = World.DefaultGameObjectInjectionWorld.EntityManager.CreateEntity(archetype);

// Or add the tag to an existing entity
World.DefaultGameObjectInjectionWorld.EntityManager.AddComponentData(entity, new Game.Objects.OutsideConnection());

// Querying entities that have the OutsideConnection tag in a SystemBase
public partial class OutsideConnectionSystem : SystemBase
{
    protected override void OnUpdate()
    {
        Entities
            .WithAll<Game.Objects.OutsideConnection>()
            .ForEach((Entity e, in SomeOtherComponent comp) =>
            {
                // Handle outside-connection entities here
            }).Schedule();
    }
}

{{ This empty marker component is intended for use with Unity.Entities (ECS) and Colossal's serialization. Use it when you need a simple tag to identify outside-connection entities for queries, archetypes, or custom save/load handling. }}