Closed ethereumdegen closed 8 months ago
Discussed in an unstructured way on Discord here, for those looking for more information / history.
the last menu that i spawn works and ONLY that one - no others one
.fn_plugin(ui_menu_state::ui_menu_state_plugin) .fn_plugin(ui_button_events::ui_button_events_plugin)
.fn_plugin(hud_menu::hud_menu_plugin)
.fn_plugin(game_over_menu::game_over_menu_plugin )
.fn_plugin( main_menu::main_menu_plugin )
.fn_plugin( character_menu::character_menu_plugin )
.fn_plugin(select_ability_menu::select_ability_menu_plugin)
.fn_plugin( system_menu::system_menu_plugin )
.fn_plugin( dialog_menu::dialog_menu_plugin )
so if i spawn my dialog menu last, that is the only one that works so it seems kind of like.... NodeBundles are overwriting the previous ones and killign the previosuly spawned one s
some of my code ^^ . Pretty standard Bevy UI stuff is what is breaking. Basically only the last NodeBundle i spawn with commands.spawn() actually works.. the others dont
If someone is able to produce an MRE based on the information here, that would be helpful.
i am also running into this as it seems. just updated to 0.13.1
and almost all UI disappeared
Encountered same bug. Seems that since 0.13.1 you can only have one root NodeBundle for UI camera (or something like this).
I am spawning UI in several separate pieces, via several nodebundles. Only first NodeBundle is displayed.
Will try to construct RME.
Example to reproduce: https://github.com/FylmTM/bevy_rme_ui
After creating minimal example, it seems that we have different behaviour now. Previously root nodes very sort of absolutely overlayed over each other. But now they are stacked.
Before (0.13.0
After (0.13.1)
This might be https://github.com/bevyengine/bevy/issues/12255#issuecomment-1974961300. This is exactly the issue I was expecting from that change.
This might be #12255 (comment). This is exactly the issue I was expecting from that change.
confirmed, reverting just my commit exhibits the 13.0 behavior.
setting PositionType::Absolute
on the root nodes seems to make it behave like it did in 13.0
use bevy::app::{App, PreStartup};
use bevy::prelude::*;
fn setup(mut commands: Commands) {
commands.spawn(Camera2dBundle::default());
let mut size = 150.;
commands.spawn(NodeBundle {
style: Style {
position_type: PositionType::Absolute,
width: Val::Px(size),
height: Val::Px(size),
..default()
},
background_color: Color::RED.into(),
..default()
});
size -= 50.;
commands.spawn(NodeBundle {
style: Style {
position_type: PositionType::Absolute,
width: Val::Px(size),
height: Val::Px(size),
..default()
},
background_color: Color::GREEN.into(),
..default()
});
size -= 50.;
commands.spawn(NodeBundle {
style: Style {
position_type: PositionType::Absolute,
width: Val::Px(size),
height: Val::Px(size),
..default()
},
background_color: Color::BLUE.into(),
..default()
});
}
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(PreStartup, setup)
.run();
}
setting
PositionType::Absolute
on the root nodes seems to make it behave like it did in 13.0
Hello :wave: I can confirm this works :heavy_check_mark:
As a consumer of Bevy, it makes sense that the 13.0 behavior only occurs when a root node is positioned absolute. Aligns with how Taffy and CSS treats absolute and relative positioning.
Bevy version
The release number or commit hash of the version you're using.
0.13.1
What you did
Describe how you arrived at the problem. If you can, consider providing a code snippet or link.
In bevy 0.13.1 , only a single NodeBundle will work. spawning multiple UI node bundles will destroy the others ones
What went wrong
Additional information