Skip to content

Game.Net.Aggregate

Assembly: Game (defined in the game's codebase / mod assembly)
Namespace: Game.Net

Type: struct

Base: System.ValueType, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable

Summary: Aggregate is an empty (marker/tag) ECS component used by the game's systems to mark or group entities for network aggregation/processing. The struct is deliberately laid out with StructLayout(LayoutKind.Sequential, Size = 1) to ensure a non-zero size for runtime/serialization compatibility. It implements IComponentData so it can be attached to entities, IQueryTypeParameter so it can be used directly in query/Archetype APIs, and IEmptySerializable to participate in the game's custom serialization infrastructure.


Fields

  • This type declares no instance fields. Aggregate is intentionally empty; the StructLayout(Size = 1) attribute ensures the type occupies a single byte to avoid problems with zero-sized types in certain serialization/interop scenarios.

Properties

  • This type declares no properties. As a marker component it carries no data.

Constructors

  • public Aggregate() (implicit) Being a value type (struct), it has the default parameterless constructor provided by the runtime. No custom constructors are defined in source.

Methods

  • This type declares no methods. All behavior is provided by the presence/absence of the component on entities and by systems that query for it.

Usage Example

// Create an entity and tag it with the Aggregate marker:
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = entityManager.CreateEntity();
entityManager.AddComponentData(entity, new Game.Net.Aggregate());

// Query systems can filter by the marker:
Entities
    .WithAll<Game.Net.Aggregate>()
    .ForEach((Entity e) =>
    {
        // process aggregated entities
    })
    .Schedule();

Remarks: - The StructLayout(Size = 1) attribute is important: some serialization or interop layers may not handle truly zero-sized structs well, so the explicit size ensures safe behavior. - Because this is a marker component, use it where you want to tag entities for specialized network/aggregation logic rather than to store per-entity data.