godotengine / godotengine/godot

`_UnhandledInput` and Object Picking interact in what seems like an undocumented way

Open
#95,116 3 comments 1 reaction 1 assignee Claimed by @Sauermann View on GitHub
documentation enhancement topic:2d topic:input
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in `4.2.1.stable.official`
- Reproducible in `4.3.rc1.mono.official`
- Tested with C# and GDScript

### System information

M2 macOS - Sonoma 14.5

### Issue description

When I run the repro, I would expect all four nodes' `_unhandled_input` functions to be hit. However, it's only hit for two nodes: the `Sprite2D` and the `SubViewport` . This seems counter to what's documented [here](https://docs.godotengine.org/en/stable/tutorials/inputs/inputevent.html#how-does-it-work) since:

- I'm never marking any input as handled
- Physics picking should happen _after_ unhandled input is processed
- Even if physics picking happened beforehand, I don't have any colliders in the scene

### Steps to reproduce

1. Set up this scene tree:
- `VBoxContainer` (`mouse_filter == MOUSE_FILTER_PASS`)
- `SubViewportContainer` (`mouse_filter == MOUSE_FILTER_PASS`)
- `SubViewport` (`gui_disable_input == false`, `physics_object_picking == true`)
- `Sprite2D`
2. Add a script to each node whose `_unhandled_input` function simply logs the component's name.
3. Right-click in the game window.

What prints is:

```
Sprite2D
SubViewport
```

What I would expect is what happens when `physics_object_picking` is disabled:

```
Sprite2D
SubViewport
SubViewportContainer
VBoxContainer
```

I can't tell if this is a bug, incorrect documentation, or just a poor understanding on my part of what's happening. But I've spent several hours now trying various things out, looking up issues, and looking through the engine code and I still don't have an explanation for why I'm seeing this behavior. 😓

### Minimal reproduction project (MRP)

[viewportrepro.zip](https://github.com/user-attachments/files/16486463/viewportrepro.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.