Skip to content

The DebugPickingPlugin interacts weirdly with the ViewportNode #24773

Description

@TheNeikos

Bevy version and features

  • latest main as well as 0.19

What you did

Simply enable the DebugPickingPlugin and move cursor over a ViewportNode.

Here's a diff for the viewport_node example that showcases the problem, then run with

cargo run --example viewport_node -F bevy_dev_tools

diff --git i/examples/ui/widgets/viewport_node.rs w/examples/ui/widgets/viewport_node.rs
index 7dbf2b292..6aacda880 100644
--- i/examples/ui/widgets/viewport_node.rs
+++ w/examples/ui/widgets/viewport_node.rs
@@ -5,12 +5,30 @@ use bevy::{
     camera::RenderTarget, picking::pointer::PointerInteraction, prelude::*,
     render::render_resource::TextureFormat, ui::widget::ViewportNode,
 };
+use bevy::dev_tools::picking_debug::DebugPickingMode;
+use bevy::dev_tools::picking_debug::DebugPickingPlugin;
+
 
 fn main() {
     App::new()
         .add_plugins((DefaultPlugins, MeshPickingPlugin))
         .add_systems(Startup, test)
         .add_systems(Update, draw_mesh_intersections)
+        .add_plugins(DebugPickingPlugin)
+        .insert_resource(DebugPickingMode::Normal)
+        .add_systems(
+            PreUpdate,
+            (|mut mode: ResMut<DebugPickingMode>| {
+                *mode = match *mode {
+                    DebugPickingMode::Disabled => DebugPickingMode::Normal,
+                    _ => DebugPickingMode::Disabled,
+                };
+            })
+            .run_if(bevy::input::common_conditions::input_just_pressed(
+                    KeyCode::F3,
+            )),
+        )
+
         .run();
 }
 

What went wrong

Hovering over the ViewportNode makes it disappear, as well as toggling the DebugPickingMode also makes the ViewportNode appear/disappear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-BugAn unexpected or incorrect behaviorS-Needs-TriageThis issue needs to be labelled

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions