Migrate cameras to required components#15641
Merged
alice-i-cecile merged 14 commits intoOct 5, 2024
Merged
Conversation
Jondolf
commented
Oct 4, 2024
LiamGallagher737
approved these changes
Oct 4, 2024
KirmesBude
reviewed
Oct 4, 2024
KirmesBude
reviewed
Oct 4, 2024
KirmesBude
approved these changes
Oct 4, 2024
Merged
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Oct 11, 2024
# Objective Since #15641, `loading_screen` panics. ``` called `Result::unwrap()` on an `Err` value: MultipleEntities("bevy_ecs::query::state::QueryState<&mut bevy_render::view::visibility::Visibility, bevy_ecs::query::filter::With<loading_screen::LoadingScreen>>") ``` Before that PR, the camera did not have a `Visibility` component. But `Visibility` is now a required component of `Camera`. So the query matches multiple entities. ## Solution Minimal change to make the example behave like it used to. Plus a tiny drive-by cleanup to remove a redundant unwrap. ## Testing `cargo run --example loading_screen`
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.
Objective
Yet another PR for migrating stuff to required components. This time, cameras!
Solution
As per the selected proposal, deprecate
Camera2dBundleandCamera3dBundlein favor ofCamera2dandCamera3d.Adding a
CamerawithoutCamera2dorCamera3dnow logs a warning, as suggested by Cart on Discord. I would personally like cameras to work a bit differently and be split into a few more components, to avoid some footguns and confusing semantics, but that is more controversial, and shouldn't block this core migration.Testing
I ran a few 2D and 3D examples, and tried cameras with and without render graphs.
Migration Guide
Camera2dBundleandCamera3dBundlehave been deprecated in favor ofCamera2dandCamera3d. Inserting them will now also insert the other components required by them automatically.