Game.Prefabs.WaterTowerData
Assembly: Assembly-CSharp (game assembly; actual assembly name may vary)
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType
Summary:
WaterTowerData is an empty/tag ECS component used by the game to mark entities that represent water towers (or to indicate the water-tower prefab/role). It is laid out with a fixed size of 1 byte to support the game's/custom serialization pipeline. The type implements Unity.Entities.IComponentData so it can be added to entities, Unity.Entities.IQueryTypeParameter to be usable in queries/type parameters, and Colossal.Serialization.Entities.IEmptySerializable to participate in Cities: Skylines 2's (Colossal) serialization for empty components.
Fields
- This struct declares no instance fields. It is intentionally empty and used as a marker/tag component.
Properties
- This struct declares no properties.
Constructors
public WaterTowerData()
This struct uses the implicit parameterless constructor provided by C#. No explicit constructors are declared. The [StructLayout(LayoutKind.Sequential, Size = 1)] attribute forces the struct to occupy 1 byte for serialization purposes.
Methods
- This struct declares no methods.
Usage Example
using Unity.Entities;
using Game.Prefabs;
// Create an entity with WaterTowerData via an archetype
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
var archetype = em.CreateArchetype(typeof(WaterTowerData));
Entity waterTowerEntity = em.CreateEntity(archetype);
// Or add the marker to an existing entity
em.AddComponentData(existingEntity, new WaterTowerData());
// Query for entities that have the WaterTowerData marker
// (example inside a SystemBase)
Entities
.WithAll<WaterTowerData>()
.ForEach((Entity e) =>
{
// handle water tower entity
}).Schedule();
{{ Additional notes: - The [StructLayout(LayoutKind.Sequential, Size = 1)] attribute ensures the component is non-zero sized, which can be required by some serializers and tooling used by the game. - IEmptySerializable is part of Colossal.Serialization.Entities and signals the custom serialization system that this is an intentionally empty component; this is important for save/load compatibility. - Because this is a marker component (no data), prefer using it only when you need to tag entities or discriminate them in queries, rather than storing per-entity data. }}