Skip to content

UI elements randomly disappear for some frames on specific android devices #14710

@MarcoMeijer

Description

@MarcoMeijer

Bevy version

Bevy 0.14.1

Relevant system information

Samsung Galaxy A34
Cargo 1.80.0
Built using https://github.com/NiklasEi/xbuild

What you did

Rendered user interface and a regular sprite.

use bevy::prelude::*;

#[bevy_main]
fn main() {
    let mut app = App::new();
    app.add_plugins(DefaultPlugins).add_systems(Startup, setup);
    app.run();
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn((Camera2dBundle::default(), IsDefaultUiCamera));
    commands.spawn((
        NodeBundle {
            style: Style {
                width: Val::Px(500.0),
                height: Val::Px(125.0),
                ..default()
            },
            ..default()
        },
        UiImage::new(asset_server.load("branding/bevy_logo_dark_big.png")),
    ));
    commands.spawn(SpriteBundle {
        transform: Transform::from_xyz(0., 0., 0.),
        sprite: Sprite {
            custom_size: Some(Vec2::new(500., 125.)),
            ..default()
        },
        texture: asset_server.load("branding/bevy_logo_dark_big.png"),
        ..default()
    });
}

What went wrong

The ui image is flickering, but the regular sprite is not flickering.

Additional information

XRecorder_11082024_193820.mp4

One of my play testers for my game has this issue, this was recorded on their phone. Other people, including me don't have this issue so it could be a device related issue. This flickering also happens on text and 9-slices (not shown in example).

This issue happened once to me, but never again after that. But on this persons phone it seems to happen almost always.

This might be a related issue: gfx-rs/wgpu#2399, but I am not sure since it only happens on UI elements as shown in the video.

This pull request seems to be solving a similar issue: #13462.

Maybe this bug has something to do with system ordering?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenA-UIGraphical user interfaces, styles, layouts, and widgetsA-WindowingPlatform-agnostic interface layer to run your app inC-BugAn unexpected or incorrect behaviorO-AndroidSpecific to the Android mobile operating systemS-Needs-InvestigationThis issue requires detective work to figure out what's going wrong

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions