Game.Objects.ActivityLocation
Assembly:
Assembly-CSharp (typical for game types in Cities: Skylines 2; may also be part of a game-specific runtime assembly)
Namespace:
Game.Objects
Type:
struct
Base:
Implements:
- Unity.Entities.IComponentData
- Unity.Entities.IQueryTypeParameter
- Colossal.Serialization.Entities.IEmptySerializable
Summary:
ActivityLocation is an empty/tag component struct used by the ECS to mark or tag entities as an "activity location". The type is laid out with StructLayout(Size = 1) so it occupies a minimal non-zero size for serialization/interop purposes. As an empty IComponentData, it is intended purely as a marker (no payload) and can be used in queries or to add/remove behavioral flags on entities. Implementing IEmptySerializable indicates it is safe/expected to be serialized even though it carries no data.
Fields
- This struct declares no instance fields.
Additional notes: - The type is decorated with [StructLayout(LayoutKind.Sequential, Size = 1)], which forces a size of 1 byte for interop/serialization despite containing no fields.
Properties
- This type exposes no properties.
Constructors
- public ActivityLocation() (implicit default value-type constructor)
{{ The struct has the implicit parameterless constructor provided by the CLR for value types. You can create instances withnew ActivityLocation()
or rely on default initialization when used as a component. }}
Methods
- This type declares no methods.
{{ It is purely a marker component; behavior is provided by systems that check for the presence/absence of this component on entities. }}
Usage Example
// Add marker to an entity (EntityManager API)
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity myEntity = entityManager.CreateEntity();
entityManager.AddComponentData(myEntity, new Game.Objects.ActivityLocation());
// Query in a SystemBase/ComponentSystem using WithAll or HasComponent
public partial class ActivityLocationSystem : SystemBase
{
protected override void OnUpdate()
{
Entities
.WithAll<Game.Objects.ActivityLocation>()
.ForEach((Entity entity, in SomeOtherComponent other) =>
{
// Handle entities that are activity locations
})
.ScheduleParallel();
}
}
{{ YOUR_INFO: Use ActivityLocation as a lightweight tag to mark entities that represent places where activities occur (e.g., service points, job locations, POIs). Because it is empty, adding/removing it is cheap and efficient for archetype-based queries. When serializing mod data or interacting with native code, the StructLayout(Size = 1) attribute ensures the component has a non-zero footprint expected by some serializers. }}