Skip to content

Commit 09a3d8a

Browse files
DJMcNabhoshino111
andcommitted
Allow minimising in 2d (#4527)
# Objective - We can't minimise if there's a 2d camera because ??? there legally must be a 2d target. - Fixes #4526 - Fixes #4856 ## Solution - Make it not crash in those cases, just do nothing - Seems to work ¯\\_(ツ)_/¯ - See also the companion commit in #3597 - 503c247 Co-authored-by: Asteria <[email protected]>
1 parent 6058413 commit 09a3d8a

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

crates/bevy_core_pipeline/src/main_pass_2d.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ impl Node for MainPass2dNode {
3939
world: &World,
4040
) -> Result<(), NodeRunError> {
4141
let view_entity = graph.get_input_entity(Self::IN_VIEW)?;
42-
let (transparent_phase, target) = self
43-
.query
44-
.get_manual(world, view_entity)
45-
.expect("view entity should exist");
42+
// If there is no view entity, do not try to process the render phase for the view
43+
let (transparent_phase, target) = match self.query.get_manual(world, view_entity) {
44+
Ok(it) => it,
45+
_ => return Ok(()),
46+
};
4647

4748
if transparent_phase.items.is_empty() {
4849
return Ok(());

crates/bevy_ui/src/render/render_pass.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,16 @@ impl Node for UiPassNode {
6666
world: &World,
6767
) -> Result<(), NodeRunError> {
6868
let view_entity = graph.get_input_entity(Self::IN_VIEW)?;
69-
let (transparent_phase, target) = self
70-
.query
71-
.get_manual(world, view_entity)
72-
.expect("view entity should exist");
69+
70+
// If there is no view entity, do not try to process the render phase for the view
71+
let (transparent_phase, target) = match self.query.get_manual(world, view_entity) {
72+
Ok(it) => it,
73+
_ => return Ok(()),
74+
};
7375

7476
if transparent_phase.items.is_empty() {
7577
return Ok(());
7678
}
77-
7879
let pass_descriptor = RenderPassDescriptor {
7980
label: Some("ui_pass"),
8081
color_attachments: &[RenderPassColorAttachment {

0 commit comments

Comments
 (0)