Game.Prefabs.WelfareOfficeData
Assembly:
Assembly-CSharp (typical for Cities: Skylines 2 mods — the source file does not declare a specific assembly)
Namespace:
Game.Prefabs
Type:
struct
Base:
System.ValueType
Summary:
WelfareOfficeData is an empty marker component (a zero-logic struct) used with Unity's ECS and Colossal's serialization utilities. It has no fields and serves purely as a tag to identify entities or prefabs that represent a welfare office. The struct is annotated with StructLayout(LayoutKind.Sequential, Size = 1) to force a non-zero size (1 byte), which can be important for native interop and serialization, and it implements the following interfaces:
- Unity.Entities.IComponentData — marks it as a data component for Unity's ECS.
- Unity.Entities.IQueryTypeParameter — allows the type to be used in query type parameters.
- Colossal.Serialization.Entities.IEmptySerializable — indicates there is nothing to serialize (an empty payload).
Fields
- None.
This type is intentionally empty (no instance fields); the StructLayout attribute sets Size = 1 to avoid zero-size layout.
Properties
- None.
Constructors
public WelfareOfficeData()
Implicit default parameterless constructor. No initialization is required because the struct contains no data.
Methods
- None (no instance methods).
Behavior is entirely via the marker semantics from the implemented interfaces.
Usage Example
// Add the marker component to an entity (EntityManager API)
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var welfareEntity = entityManager.CreateEntity();
entityManager.AddComponentData(welfareEntity, new WelfareOfficeData());
// Query for entities tagged with WelfareOfficeData (Entities.ForEach / System queries)
Entities
.WithAll<WelfareOfficeData>()
.ForEach((Entity e) =>
{
// operate on welfare office entities
}).Schedule();
{{ Additional notes: - Use this component when you need to tag entities/prefabs as welfare offices without storing any extra data. - The IEmptySerializable interface indicates serializers should treat this as having no payload; registration with Colossal's serialization system may be required depending on mod context. - For native interop or reflection-based systems that disallow zero-sized structs, the explicit Size = 1 avoids related issues. }}