Game.EffectsUpdated
Assembly:
Typically defined in your mod assembly (often Assembly-CSharp or a mod-specific assembly).
{{ This struct is a small, tag-style component included in the Game.Common namespace. If you compile it into a mod DLL, it will reside in that mod's assembly — in Cities: Skylines 2 modding it's common to place such ECS components in the mod's own assembly or the game's Assembly-CSharp. }}
Namespace: Game.Common {{ Placed under Game.Common as shown in the source file. }}
Type: struct {{ EffectsUpdated is declared as a value type (struct). }}
Base: Implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter {{ This is a marker/tag component used by the ECS. It does not carry runtime data beyond its presence on an entity. }}
Summary: A zero-data/tag component used to mark entities whose "effects" have been updated. {{ EffectsUpdated is annotated with [StructLayout(LayoutKind.Sequential, Size = 1)] to ensure it occupies at least 1 byte (avoiding being a true zero-sized component). It functions as a lightweight flag you can add/remove to entities to indicate that some effects-related update occurred and systems should react to it. As it implements IQueryTypeParameter it can be used directly in queries and query parameter contexts. }}
Fields
- None {{ The struct defines no fields. The source uses StructLayout to force a size of 1 byte, but there are no explicit fields declared. }}
Properties
- None {{ This type does not expose any properties. It is a pure tag/component marker. }}
Constructors
- Default value-type constructor (implicit) {{ No explicit constructors are defined. Use the default parameterless constructor (new EffectsUpdated()) when adding the component. }}
Methods
- None {{ The struct defines no methods. Behavior is provided by systems that add/remove or query for this component. }}
Usage Example
// Add the tag to an entity
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
var e = em.CreateEntity();
em.AddComponentData(e, new Game.Common.EffectsUpdated());
// Query for entities with the tag inside a SystemBase
public partial class EffectsProcessingSystem : SystemBase
{
protected override void OnUpdate()
{
var em = EntityManager;
Entities
.WithAll<Game.Common.EffectsUpdated>()
.ForEach((Entity entity) =>
{
// Handle updated effects for this entity
// ...
// Remove the tag once handled
em.RemoveComponent<Game.Common.EffectsUpdated>(entity);
})
.WithoutBurst()
.Run();
}
}
{{ This example shows adding the EffectsUpdated tag to an entity and a simple SystemBase that queries entities with the tag, processes them, and removes the tag. Use .Schedule()/.ScheduleParallel() and Burst where appropriate for performance; removal of components may require structural changes (use appropriate APIs or patterns such as EntityCommandBuffer in scheduled contexts). }}