Fix UI elements randomly not appearing after #13277. #13462
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We invoked the
extract_default_ui_camera_viewsystem twice: once for 2D cameras and once for 3D cameras. This was fine before moving to resources for render phases, but, after the move to resources, the first thing such systems do is to clear out all the entities-to-be-rendered from the previous frame. So, if the scheduler happened to runextract_default_ui_camera_view::<Camera2d>first, then all the UI elements that it queued would be overwritten by theextract_default_ui_camera_view::<Camera3d>system, or vice versa. The ordering dependence is the reason why this problem was intermittent.This commit fixes the problem by merging the two systems into one systems, using an
Orquery filter.Migration Guide
bevy_ui::render::extract_default_ui_camera_viewsystem is no longer parameterized over the specific type of camera and is hard-wired to eitherCamera2dorCamera3dcomponents.