Add First/Pre/Post/Last schedules to the Fixed timestep#10977
Add First/Pre/Post/Last schedules to the Fixed timestep#10977alice-i-cecile merged 4 commits intobevyengine:mainfrom
Conversation
|
Companion to #10969, which does a similar transformation for startup schedules. |
|
what's the reason for the disparity? |
It seems like it'd be better to ask this in the other PR. Especially if it's something that's blocking you. |
I can ask "why First doesn't exist for Startup", and that question belongs to other PR. I can ask "why First exists for FixedUpdate", and that question belongs here. But that's the same fundamental question. Is This PR is the one that adds |
The only difference between fixed and main is that one is variable timing vs a set tick rate. Ideally all gameplay logic is in Startup is different in that it is just a setup tool for spawning scenes/ui/whatever or inserting resources or something. I don't have much objection to We mostly say this is better talked about in the other one because it is effectively the same thing as this PR but for |
# Objective Allow `Gizmos` to work in `FixedUpdate` without any changes needed. This changes `Gizmos` from being a purely immediate mode api, but allows the user to use it as if it were an immediate mode API regardless of schedule context. Also allows for extending by other custom schedules by adding their own `GizmoStorage<Clear>` and the requisite systems: - `propagate_gizmos::<Clear>` before `update_gizmo_meshes` - `stash_default_gizmos` when starting a clear context - `pop_default_gizmos` when ending a clear context - `collect_default_gizmos` when grabbing the requested gizmos - `clear_gizmos` for clearing the context's gizmos ## Solution Adds a generic to `Gizmos` that defaults to `Update` (the current way gizmos works). When entering a new clear context the default `Gizmos` gets swapped out for that context's duration so the context can collect the gizmos requested. Prior work: #9153 ## To do - [x] `FixedUpdate` should probably get its own First, Pre, Update, Post, Last system sets for this. Otherwise users will need to make sure to order their systems before `clear_gizmos`. This could alternatively be fixed by moving the setup of this to `bevy_time::fixed`? PR to fix this issue: #10977 - [x] use mem::take internally for the swaps? - [x] Better name for the `Context` generic on gizmos? `Clear`? --- ## Changelog - Gizmos drawn in `FixedMain` now last until the next `FixedMain` iteration runs.
Fixes #10974
Objective
Duplicate the ordering logic of the
Mainschedule into theFixedMainschedule.Changelog
FixedUpdateis no longer the main schedule ran inRunFixedUpdateLoop,FixedMainhas replaced this and has a similar structure toMain.Migration Guide
RunFixedUpdateLoopshould be renamed toRunFixedMainLoop.