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

SystemState.ShouldRunSystem

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

Declaration

public bool ShouldRunSystem();

Returns

bool True if the system should be updated, or false if not.

Description

Reports whether this system satisfies the criteria to update. This function is used internally to determine whether the system's OnUpdate function can be skipped.

By default, systems will invoke OnUpdate every frame. If a system calls SystemState.RequireForUpdate or SystemState.RequireForUpdate in OnCreate, it will only update if all of its required components exist and required queries match existing chunks. This check uses [IsEmptyIgnoreFilter], so the queries may still be empty if they use filters or [Enableable Components]. If a system has the RequireMatchingQueriesForUpdateAttribute it will update if any EntityQuery it uses match existing chunks. This check also uses [IsEmptyIgnoreFilter], so all queries may still be empty if they use filters or [Enableable Components]. Note: Other factors might prevent a system from updating, even if this method returns true. For example, a system will not be updated if its [Enabled] property is false.

[IsEmptyIgnoreFilter]: xref:Unity.Entities.EntityQuery.IsEmptyIgnoreFilter [Enableable Components]: xref:Unity.Entities.IEnableableComponent [Enabled]: xref:Unity.Entities.SystemState.Enabled