Fix UI elements randomly not appearing after #13277.#13462
Merged
mockersf merged 1 commit intobevyengine:mainfrom May 21, 2024
Merged
Fix UI elements randomly not appearing after #13277.#13462mockersf merged 1 commit intobevyengine:mainfrom
mockersf merged 1 commit intobevyengine:mainfrom
Conversation
We invoked the `extract_default_ui_camera_view` system 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 run `extract_default_ui_camera_view::<Camera2d>` first, then all the UI elements that it queued would be overwritten by the `extract_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 `Or` query filter.
alice-i-cecile
approved these changes
May 21, 2024
CrumbsTrace
approved these changes
May 21, 2024
mockersf
approved these changes
May 21, 2024
IceSentry
approved these changes
May 21, 2024
Contributor
IceSentry
left a comment
There was a problem hiding this comment.
I guess it's technically possible for users to have been using that with the generic parameter but I doubt it's all that common.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.