Search Issue Tracker

By Design

Votes

0

Found in [Package]

1.3.8 - Entities

Issue ID

ECSB-1441

Regression

No

System Group Executes Only Once Per Frame when Not Using SystemAPI.GetSingletonRW or EntityManager.SetComponentData

Package: Entity Component System (ECS)

-

Reproduction steps:
1. Open the attached “UpdateSystemGroup.zip” project
2. Open the “Assets/Scenes/SampleScene.unity” Scene
3. Enter the Play Mode
4. Press the W and E keys
5. Observe the Console window to confirm that the systems run 100 times for each system
6. Press the Q key
7. Observe the Console window

Expected result: Systems should trigger and log output 100 times for each system
Actual result: Systems run only once for each system

Reproducible with: 1.2.4 (2022.3.52f1), 1.3.8 (2022.3.52f1, 6000.0.29f1, 6000.1.0a7)

Reproducible on: Windows 11
Not reproducible on: No other environment tested

  1. Resolution Note:

    The package is behaving as designed. In an idiomatic foreach over an EntityQuery, the change versions of of the query's RW components are updated once in the loop preamble, not per loop iteration (or per RefRW.value write). This is to avoid unnecessary overhead in the overwhelmingly common case where the change version isn't changing over the course of the loop. If you want to force the change version to be updated for each loop iteration, you can use the approaches in the W and E loops as a workaround.

    In general, due to the way EntityQuery instances are cached and shared between systems, the behavior of change versions and query filtering is significantly more difficult to reason about when a system is both reading/writing component data and also updating other systems, especially when the same EntityQuery is used by both the parent and child systems. For this reason, as a best practice to avoid confusion, we recommend that most ECS systems should either only manipulate component data or only update other systems.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.