ForEachAttribute
Runs a method of an EcsSystem (or a static method of any other type, through a generated entry point) for every entity matching its component parameters…
public sealed class ForEachAttribute : AttributeRuns a method of an EcsSystem (or a static method of any other type, through a generated entry point) for every entity matching its component parameters (and the WithAttribute / WithoutAttribute / WithAnyAttribute filters), each update, after EcsSystem.OnUpdate, in declaration order.
public class MovementSystem : EcsSystem
{
[ForEach, Without<Frozen>]
static void Move(ref Position p, in Velocity v) { p.X += v.X; p.Y += v.Y; }
}EasyEcs.Generator compiles it to a struct job (IForEach, IForEachEntity or IForEachBatch): no delegate, no allocation, inlined.
Constructors
ForEachAttribute
public ForEachAttribute();Properties
Parallel
public bool Parallel { get; init; }Run chunks of the matching rows on several threads (World.ForEachParallel). The method must make no structural change, run per entity and write no singleton (EECS010); it pays off for heavy per-row work over tens of thousands of rows. Default false.
Last updated on
How is this guide?
EntitySpan
The entities of one run of rows in a batch job: element i is the entity whose components are element i of the run's spans.
ICleanupComponent
Marks a component that outlives the destruction of its entity: destroying an entity holding one removes its other components and adds the Destroyed tag…