Game.Buildings.ResidentialProperty
Assembly: Assembly-CSharp
Namespace: Game.Buildings
Type: struct
Base: System.ValueType
Summary:
ResidentialProperty is an empty/tag ECS component used to mark an entity as a residential property. It's defined as a one-byte sequential-layout struct and implements ECS and modding-related marker interfaces so it can be used in Entity queries and serialized by Colossal Order's serialization systems. The small explicit size prevents a zero-sized type when marshalled/serialized.
Fields
- None (this struct contains no fields) This type is intentionally empty — it functions purely as a tag/marker component.
Properties
- None
There are no instance properties on this component.
Constructors
- public ResidentialProperty() (implicit default) Structs in C# always have an implicit public parameterless constructor; since the type has no fields the default constructor simply produces the empty tag value.
Methods
- None No instance or static methods are defined.
Remarks / Implementation details
- [StructLayout(LayoutKind.Sequential, Size = 1)] — forces the marshaled size to be 1 byte. This avoids a zero-sized type when interacting with low-level/native/serialization code.
- Implements Unity.Entities.IComponentData — makes the type a DOTS component that can be attached to entities.
- Implements Unity.Entities.IQueryTypeParameter — marks the type so it can be used in certain query APIs (serves as a queryable marker).
- Implements Colossal.Serialization.Entities.IEmptySerializable — signals Colossal Order's serialization system that this is an empty-serializable type suitable for the game's save/serialization pipeline.
- Typical use is as a tag component (no payload) to filter or categorize entities (for example: residential building entities).
Usage Example
// Add the tag to an entity using EntityManager:
var residentialTag = new Game.Buildings.ResidentialProperty();
entityManager.AddComponentData(buildingEntity, residentialTag);
// Query for all entities that have the tag in a SystemBase:
public partial class ProcessResidentialSystem : SystemBase
{
protected override void OnUpdate()
{
Entities
.WithAll<Game.Buildings.ResidentialProperty>()
.ForEach((Entity e) =>
{
// Process residential building entity 'e'
})
.WithoutBurst()
.Run();
}
}
Notes: - Because the component contains no data, you can use it as a cheap filter/tag in archetypes and queries. - When serializing or interacting with native code, the explicit Size = 1 prevents issues with zero-length types.