Game.City.CityServiceUpkeep
Assembly:
Game (game managed assembly for Cities: Skylines 2)
Namespace:
Game.City
Type:
struct (value type)
Base:
System.ValueType
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable
Summary:
CityServiceUpkeep is an empty marker component (1-byte struct) used by the game's ECS to mark entities that participate in the city service upkeep systems. The type is explicitly laid out with StructLayout(LayoutKind.Sequential, Size = 1) so it has a stable, minimal size for efficient storage and serialization. Implementing IEmptySerializable indicates it is handled by the game's custom serialization path (Colossal.Serialization). As a marker component it contains no fields or methods — it's used only for tagging/querying.
Fields
- This struct defines no instance fields. The StructLayout attribute forces the struct size to 1 byte for storage/serialization efficiency.
Properties
- This type defines no properties.
Constructors
public CityServiceUpkeep()
This is the implicit default constructor for the struct. It creates an empty marker value; because the struct is explicitly sized to 1 byte, instances are compact when stored in component storage.
Methods
- This type defines no methods. It only exists as an ECS marker component and for query/filter usage.
Usage Example
using Unity.Entities;
using Game.City;
// Add the marker to an entity (EntityManager API)
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity myEntity = entityManager.CreateEntity();
entityManager.AddComponentData(myEntity, new CityServiceUpkeep());
// Query entities that have the marker
Entities
.WithAll<CityServiceUpkeep>()
.ForEach((Entity e) =>
{
// handle upkeep logic for entity e
}).Schedule();
{{ Additional notes: - Because CityServiceUpkeep implements IQueryTypeParameter, it can be used directly in query construction (WithAll/WithNone/WithAny). - Because it implements IEmptySerializable (Colossal.Serialization.Entities.IEmptySerializable), the game's save/load system recognizes it as an empty serializable component and will preserve the tag across saves. - Use this type when you need to tag entities for city-level maintenance/upkeep systems without storing extra data. }}