Documentation

Unity Engine


Unity Engine


ShouldRunSystem()

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.
Read time 1 minuteLast updated a day ago

Definition

  • Type: Method
  • Namespace: Unity.Entities
  • Assembly: UnityEngine.EntitiesModule
public bool ShouldRunSystem()

Returns

Type

Description

boolTrue if the system should be updated, or false if not.

Remarks

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.