mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 22:50:19 +00:00
be46d1502b
# Objective During testing, I observed that the `FrameCount` resource (`bevy_core`) was being incremented by `FrameCountPlugin` non-deterministically, during update, subject to the whims of the execution order. The effect was that the counter could and did change while a frame was still in flight, while user-systems were still executing. ## Solution I have delayed the incrementing of the `FrameCount` resource to `CoreStage::Last`. The resource was described in the documentation as "*a count of rendered frames*" and, after my change, it actually will match that description. ## Changes - `CoreStage::Last` was chosen so that the counter will be `0` during all earlier stages of the very first execution of the schedule. - Documentation added declaring *when* the counter is incremented. - Hint added, directing users towards `u32::wrapping_sub()` because integer overflow is reasonable to expect. ## Note Even though this change might have a short time-to-live in light of the upcoming *Stageless* changes, I think this is worthwhile – at least as an in-code reminder that this counter should behave predictably. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |