Skip to content
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

It is impossible to use RenderLayers to draw on top of UI #7012

Closed
nicopap opened this issue Dec 23, 2022 · 2 comments
Closed

It is impossible to use RenderLayers to draw on top of UI #7012

nicopap opened this issue Dec 23, 2022 · 2 comments
Labels
A-Rendering Drawing game state to the screen A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior S-Duplicate This issue or PR already exists

Comments

@nicopap
Copy link
Contributor

nicopap commented Dec 23, 2022

Bevy version: main 1aeaafa (23rd of Dec 2022)

What you did

Using RenderLayers with two different cameras: One of top with the UiCameraConfig { show_ui: false } component, and one behind with an UI, I expect a UI to show up, with the viewport of the second camera overlayed on top.

What went wrong

It seems the UI doesn't show up when the top layer of a viewport has the UI disabled.

Expected

render_layer_ui_should_2022-12-23

Actual

render_layer_ui_actual_2022-12-23

Minimal reproducible example

use bevy::{core_pipeline::clear_color::ClearColorConfig, prelude::*, render::view::RenderLayers};

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_startup_system(startup)
        .run();
}

fn startup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn(Camera2dBundle {
        camera_2d: Camera2d {
            clear_color: ClearColorConfig::Custom(Color::WHITE),
        },
        ..default()
    });
    commands.spawn((
        UiCameraConfig { show_ui: false },
        Camera2dBundle {
            camera_2d: Camera2d { clear_color: ClearColorConfig::None },
            camera: Camera { order: 1, ..default() },
            ..default()
        },
        RenderLayers::layer(1),
    ));

    commands.spawn(NodeBundle {
        style: Style {
            size: Size::new(Val::Percent(100.0), Val::Percent(50.0)),
            ..default()
        },
        background_color: BackgroundColor(Color::rgba(0.8, 0.0, 0.0, 0.8)),
        ..default()
    });

    commands.spawn((SpriteBundle {
        texture: asset_server.load("branding/icon.png"),
        transform: Transform::from_scale(Vec3::splat(2.0)),
        ..default()
    },));
    commands.spawn((
        SpriteBundle {
            texture: asset_server.load("branding/icon.png"),
            ..default()
        },
        RenderLayers::layer(1),
    ));
}
@nicopap nicopap added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen A-UI Graphical user interfaces, styles, layouts, and widgets labels Dec 23, 2022
@irate-devil
Copy link
Contributor

irate-devil commented Dec 23, 2022

The camera priority should be -1 instead of 1.
nvm I can't read 🤔

@nicopap
Copy link
Contributor Author

nicopap commented Jan 16, 2023

Duplicate, Same issue as:

@nicopap nicopap closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2023
@nicopap nicopap added the S-Duplicate This issue or PR already exists label Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior S-Duplicate This issue or PR already exists
Projects
None yet
Development

No branches or pull requests

2 participants