Skip to content

non-root TargetCameras are not ignored #15143

@ickshonpe

Description

@ickshonpe

Bevy version

main

What you did

Added this system to render_ui_to_texture:

fn target_cameras(
    mut commands: Commands,
    mut count: Local<usize>,
    mut query: Query<&mut TargetCamera, With<Parent>>,
) {
    *count += 1;
    if *count == 2 {
        // spawn a UI camera!
        let ui_camera = commands
            .spawn(Camera2dBundle {
                camera: Camera {
                    order: 10,
                    ..Default::default()
                },
                ..Default::default()
            })
            .id();

        for mut c in query.iter_mut() {
            c.0 = ui_camera;
        }
    }
}

What went wrong

rtt

Non-root TargetCameras are meant to have no effect but update_target_camera_system only does an update if it detects changes to the root node's TargetCamera and not the TargetCamera components of any of the rest of the entities in the UI node tree.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenA-UIGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behaviorS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions