Skip to content

Game.Net.Waterway

Assembly:
Assembly-CSharp

Namespace: Game.Net

Type: struct

Base: Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable

Summary: Waterway is an empty marker component used by the game's ECS to mark entities that represent waterways. It is a blittable, single-byte-sized struct (StructLayout(LayoutKind.Sequential, Size = 1)) so it can be used efficiently in native containers, queries, and the game's custom serialization pipeline. As an IEmptySerializable, it participates in Colossal's serialization without carrying payload data — its presence/absence is what matters.


Fields

  • This struct contains no instance fields; it is intentionally empty and used only as a marker component. {{ The StructLayout attribute sets the struct size to 1 to avoid a zero-sized type in native storage, ensuring predictable memory layout for ECS and serialization. }}

Properties

  • This type exposes no properties. {{ Use it as a tag in ECS queries and component sets rather than storing data. }}

Constructors

  • public Waterway() {{ Waterway is a value type and therefore has the implicit default parameterless constructor. No custom constructor logic is defined. }}

Methods

  • This type declares no methods. {{ Its behavior is entirely defined by its role as a marker component and by the interfaces it implements (IComponentData, IQueryTypeParameter, IEmptySerializable). }}

Usage Example

using Unity.Entities;
using Game.Net;

// Add the marker to an existing entity
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity someEntity = /* obtain or create entity */;
entityManager.AddComponentData(someEntity, new Waterway());

// Query entities that have the Waterway tag
Entities.WithAll<Waterway>().ForEach((Entity e) =>
{
    // e is a waterway entity
}).Run();

{{ Notes: - Treat Waterway as a tag/marker. Do not expect any payload values. - The IEmptySerializable interface integrates the tag into Colossal's serialization system so the presence of the component will be saved/loaded as appropriate. - The 1-byte size is intentional to keep the struct blittable and to avoid zero-sized type issues in native containers and when interacting with native code. }}