Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

ComponentSystemBase.LastSystemVersion

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public uint LastSystemVersion;

Description

The current version of this system.

LastSystemVersion is updated to match the ComponentSystemBase.GlobalSystemVersion whenever a system runs.

When you use EntityQuery.SetChangedVersionFilter or ArchetypeChunk.DidChange, 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.