-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tagging ImageBundle makes it disappear #1329
Comments
I was not able to reproduce using this code with current use bevy::prelude::*;
fn main() {
App::build()
.add_plugins(DefaultPlugins)
.add_startup_system(test.system())
.run();
}
struct Test;
fn test(commands: &mut Commands, mut materials: ResMut<Assets<ColorMaterial>>, asset_server: Res<AssetServer>) {
commands.spawn(CameraUiBundle::default());
commands.spawn(ImageBundle {
style: Style {
size: Size::new(Val::Px(25.0), Val::Px(25.0)),
position_type: PositionType::Absolute,
position: Rect {
left: Val::Px(10.0),
bottom: Val::Px(10.0),
..Default::default()
},
..Default::default()
},
material: materials.add(asset_server.load("test.png").into()),
..Default::default()
}).with(Test);
} Could you give more details? |
Updating to This code: use bevy::prelude::*;
fn main() {
App::build()
.add_plugins(DefaultPlugins)
.add_startup_system(test.system())
.run();
}
struct Test;
fn test(
commands: &mut Commands,
mut materials: ResMut<Assets<ColorMaterial>>,
asset_server: Res<AssetServer>,
) {
commands
.spawn(CameraUiBundle::default())
.spawn(NodeBundle {
style: Style {
size: Size::new(Val::Percent(100.0), Val::Percent(100.0)),
position_type: PositionType::Absolute,
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
..Default::default()
},
material: materials.add(Color::NONE.into()),
..Default::default()
})
.with_children(|parent| {
// bevy logo (image)
parent.spawn(ImageBundle {
style: Style {
size: Size::new(Val::Px(50.0), Val::Px(50.0)),
..Default::default()
},
material: materials.add(asset_server.load("icon.png").into()),
..Default::default()
});
})
.spawn(ImageBundle {
style: Style {
size: Size::new(Val::Px(50.0), Val::Px(50.0)),
position_type: PositionType::Absolute,
position: Rect {
left: Val::Px(110.0),
bottom: Val::Px(10.0),
..Default::default()
},
..Default::default()
},
material: materials.add(asset_server.load("icon.png").into()),
..Default::default()
})
// .with(Test)
;
} After uncommenting |
I can reproduce. I'll try doing some debugging steps |
Yeah, so the bug is that the ImageBundle is closer than the near plane of the |
The issue is that the |
I can't reproduce this, since at least Bevy 0.6 at which point it's starting to get painful to test. The last comment seems to be alluding to an underlying bug that I think should have been fixed by #5877 though. Happy to reopen this if it turns out that's not the case. |
I am building an UI and have an absolutely positioned image using
ImageBundle
. It works until I add an additional component to it (no matter empty or not) - image then disappears.The same code, but with
TextBundle
works as expected.The text was updated successfully, but these errors were encountered: