Skip to content

BorderColor for button doesn't work #20231

Closed Answered by tim-blackbird
3TSloth asked this question in Q&A
Discussion options

You must be logged in to vote

I tested it and it appears there are some issues with having a Text component on the same entity.
Try adding the Text component as a child of the button instead:

menu_buttons.spawn((
    Node {
        border: UiRect::all(Val::Px(20.0)),
        ..default()
    },
    BackgroundColor(NORMAL_BUTTON),
    // Text::new("New Game"), // Remove this
    Button,
    MenuButtonAction::Play,
    BorderRadius::new(
        Val::Px(40.),
        Val::Px(40.),
        Val::Px(40.),
        Val::Px(40.),
    ),
    BorderColor(Color::srgb(1., 0., 0.)),
)).with_child(Text::new("New Game")); // Add the child here

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@3TSloth
Comment options

@tim-blackbird
Comment options

Answer selected by 3TSloth
@3TSloth
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants