Fix panic in example: text_wrap_debug.rs (#8497)

# Objective

- Fix panic caused by incorrectly placed background color

## Solution

- Move `BackgroundColor` inside `TextBundle`
This commit is contained in:
Ame 2023-04-26 16:17:19 -06:00 committed by GitHub
parent 323705e0ca
commit 670f3f0dce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}