Skip to content

Game.Net.LocalConnect

Assembly:
Namespace: Game.Net

Type: struct

Base: IComponentData, IQueryTypeParameter, IEmptySerializable

Summary:
LocalConnect is an empty marker component used by the game's ECS to tag entities that represent a local (loopback) network connection. It is defined with sequential layout and forced to a size of 1 byte to avoid zero-sized type layout issues. Implementing IComponentData makes it usable as a Unity ECS component; IQueryTypeParameter enables use in query filters; IEmptySerializable indicates the component is serializable by Colossal's serialization system despite containing no fields.


Fields

  • This struct declares no instance fields. It is intentionally empty (marker/tag component).

Properties

  • This struct exposes no properties.

Constructors

  • public LocalConnect()
    The default (parameterless) struct constructor is used. As an empty marker, no initialization data is required.

Methods

  • This struct declares no methods.

Usage Example

// Add the marker to an entity to mark it as a local connection
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity connEntity = entityManager.CreateEntity();
entityManager.AddComponentData(connEntity, new Game.Net.LocalConnect());

// Check whether an entity is marked as local
bool isLocal = entityManager.HasComponent<Game.Net.LocalConnect>(connEntity);

// Query all entities that are local connections
Entities
    .WithAll<Game.Net.LocalConnect>()
    .ForEach((Entity e) =>
    {
        // handle local connection entity
    })
    .Run();

// Remove the marker when no longer needed
entityManager.RemoveComponent<Game.Net.LocalConnect>(connEntity);

{{ LocalConnect is intended as a lightweight tag for ECS systems and networking code. Because it implements IEmptySerializable, the component participates in Colossal's serialization pipeline even though it carries no payload. Use it when you need to filter or identify entities representing the local/loopback connection without storing additional data. }}