Function MovementOverrideRunner.Execute

Execute (in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)

Invokes every registered callback for phase on the agents matched by query.

Public
unsafe void Execute (

in ArchetypeChunk

chunk

int

unfilteredChunkIndex

bool

useEnabledMask

in v128

chunkEnabledMask

)

Invokes every registered callback for phase on the agents matched by query.

Contract: the caller has applied PendingMovementOverrideChanges first. An agent matched here then holds the callback its marker component claims it holds, so the delegates below are invoked without a null check.

Destroying an agent from inside a callback is unsupported however it is done, being a structural change while the pointers taken below are live, which leaves this loop reading a chunk whose contents have moved. FollowerEntityProxy.Destroy also clears the agent's entry on the spot. Destroy an agent once the movement pipeline has run, or through GameObject.Destroy, which Unity defers to the end of the frame.

Each phase is its own loop, so the branch on phase is taken once per chunk instead of once per agent, and a phase only takes the chunk pointers it passes to its callback.