Skip to content

Commit 670f3f0

Browse files
authored
Fix panic in example: text_wrap_debug.rs (#8497)
# Objective - Fix panic caused by incorrectly placed background color ## Solution - Move `BackgroundColor` inside `TextBundle`
1 parent 323705e commit 670f3f0

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

examples/ui/text_wrap_debug.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,11 @@ fn spawn(mut commands: Commands, asset_server: Res<AssetServer>) {
8989
linebreak_behavior,
9090
};
9191
let text_id = commands
92-
.spawn((
93-
TextBundle {
94-
text,
95-
..Default::default()
96-
},
97-
BackgroundColor(Color::rgb(0.8 - j as f32 * 0.2, 0., 0.)),
98-
))
92+
.spawn(TextBundle {
93+
text,
94+
background_color: Color::rgb(0.8 - j as f32 * 0.2, 0., 0.).into(),
95+
..Default::default()
96+
})
9997
.id();
10098
commands.entity(column_id).add_child(text_id);
10199
}

0 commit comments

Comments
 (0)