#applying location(bottom, left etc) in style makes ui elements disappear

1 messages · Page 1 of 1 (latest)

river loom
#

i have some basic bevy code to load an image as a ImageBundle. However when apply any styling related to position both in absolute and relative mode it disappears and i can not understand why.

match music.art_url_to_tmpfile() {
                Ok(file) => {
                    println!("{}", file.display());
                    let image: Handle<Image> = asset_server.load(file);

                    commands.entity(parent_entity).with_children(|parent| {
                        parent
                            .spawn(ImageBundle {
                                image: UiImage::new(image),

                                style: Style {
                                    position_type: PositionType::Absolute,
                                    max_width: Val::Px(200.0),
                                    max_height: Val::Px(200.0),
                                    bottom: Val::Px(5.0),
                                    left: Val::Px(200.0),
                                    ..default()
                                },
                                ..default()
                            })
                            .insert(OnScreen);
                    });
                }
                Err(e) => {
                    eprintln!("{e}");
                }
river loom
#

i realised you guys might want some more context, this is how it looks without any positioning

#

and with some positioning enabled

frank vessel
#

Are you using bevy_inspector_egui if so try sliding the values around a bit, ive had issues where the sane values I'm passing in are actually rending the image far off screen (usually to the left)

mild widget