Skip to content

Commit

Permalink
Fix panic in example: text_wrap_debug.rs (#8497)
Browse files Browse the repository at this point in the history
# Objective

- Fix panic caused by incorrectly placed background color

## Solution

- Move `BackgroundColor` inside `TextBundle`
  • Loading branch information
ameknite authored Apr 26, 2023
1 parent 323705e commit 670f3f0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions examples/ui/text_wrap_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,11 @@ fn spawn(mut commands: Commands, asset_server: Res<AssetServer>) {
linebreak_behavior,
};
let text_id = commands
.spawn((
TextBundle {
text,
..Default::default()
},
BackgroundColor(Color::rgb(0.8 - j as f32 * 0.2, 0., 0.)),
))
.spawn(TextBundle {
text,
background_color: Color::rgb(0.8 - j as f32 * 0.2, 0., 0.).into(),
..Default::default()
})
.id();
commands.entity(column_id).add_child(text_id);
}
Expand Down

0 comments on commit 670f3f0

Please sign in to comment.