Property LastSystemVersion
LastSystemVersion
The current version of this system.
Declaration
public uint LastSystemVersion { get; }
Property Value
Type | Description |
---|---|
uint | The GlobalSystemVersion the last time this system ran. |
Remarks
LastSystemVersion is updated to match the GlobalSystemVersion whenever a system runs.
When you use SetChangedVersionFilter(ComponentType) or DidChange(ref DynamicComponentTypeHandle, uint), LastSystemVersion provides the basis for determining whether a component could have changed since the last time the system ran.
When a system accesses a component and has write permission, it updates the change version of that component type to the current value of LastSystemVersion. The system updates the component type's version whether or not it actually modifies data in any instances of the component type -- this is one reason why you should specify read-only access to components whenever possible.
For efficiency, ECS tracks the change version of component types by chunks, not by individual entities. If a system updates the component of a given type for any entity in a chunk, then ECS assumes that the components of all entities in that chunk could have been changed. Change filtering allows you to save processing time by skipping all entities in an unchanged chunk, but does not support skipping individual entities in a chunk that does contain changes.