#Changing the properties of a button after spawning it

7 messages · Page 1 of 1 (latest)

neon rampart
#

So I spawned a button and assigned a struct to it but how can I change the size of the button after that

#

I can't figure out the syntax

#

and I can't find anything in the documentation

#
commands
            .spawn((
                ButtonBundle {
                    style: Style {
                        size: Size::new(Val::Px(275.0), Val::Px(85.0)),
                        margin: UiRect::all(Val::Auto),
                        justify_content: JustifyContent::Center,
                        align_items: AlignItems::Center,
                        ..default()
                    },
                    background_color: NORMAL_BUTTON.into(),
                    ..default()
                },
                RestartButton,
            ))
            .with_children(|parent| {
                parent.spawn(TextBundle::from_section(
                    "restart",
                    TextStyle {
                        font: asset_server.load("pixelated_font.ttf"),
                        font_size: 40.0,
                        color: Color::rgb(0.9, 0.9, 0.9),
                    },
                ));
            });
#

It should be similar to this I think
mut query: Query<&mut Style, With<RestartButton>>,

                
 }```
dry depot
neon rampart
#

it's fine I figured it out