Select the ColorRect and set Mouse > Filter to Ignore (mouse_filter = Control.MOUSE_FILTER_IGNORE), and do the same for any Control inside it. In our Godot 4.7 test a full-screen ColorRect on a higher CanvasLayer stopped every click on a Play button under it, with its color at alpha 0 and with its modulate at alpha 0. Pass was not enough: the click reached the game's _unhandled_input(), but the button still got nothing. Ignore, or hiding the ColorRect, made the button work again.
The code
Use it on an overlay you make in code, or one with children such as a loading logo or a caption. apply() sets the overlay and everything inside it to Ignore and returns how many it changed. full_screen_catchers() lists the visible Controls that cover the whole screen and still take the mouse: print it when clicks stop working. Save it as click_through.gd, then for example: const ClickThrough := preload("res://click_through.gd") and ClickThrough.apply($Fade), or print(ClickThrough.full_screen_catchers(get_tree().root)).
extends RefCounted
## Lets mouse clicks pass through a full-screen overlay (fade, scene transition,
## post-process ColorRect) to the buttons and the game under it.
## Sets the overlay and every Control inside it to Ignore. Returns how many it changed.
static func apply(overlay: Control) -> int:
var changed := 0
var stack: Array[Node] = [overlay]
while not stack.is_empty():
var node: Node = stack.pop_back()
var c := node as Control
if c and c.mouse_filter != Control.MOUSE_FILTER_IGNORE:
c.mouse_filter = Control.MOUSE_FILTER_IGNORE
changed += 1
stack.append_array(node.get_children())
return changed
## Lists the visible Controls that cover the whole screen and still take the mouse.
## Print it when clicks stop working: anything listed here is eating them.
static func full_screen_catchers(root: Node) -> PackedStringArray:
var out := PackedStringArray()
var screen := root.get_viewport().get_visible_rect()
var stack: Array[Node] = [root]
while not stack.is_empty():
var node: Node = stack.pop_back()
var c := node as Control
if c and c.is_visible_in_tree() and c.mouse_filter != Control.MOUSE_FILTER_IGNORE and c.get_global_rect().encloses(screen):
out.append(str(c.get_path()))
stack.append_array(node.get_children())
return out
What we measured
A Button in the middle of the screen on one CanvasLayer, and a full-screen ColorRect on a CanvasLayer above it. We sent a mouse move, press and release to the middle of the screen and counted the button's pressed signal and the mouse presses that reached _unhandled_input() on the game node. Two runs gave the same numbers.
- No overlay: the button was pressed.
- ColorRect left at its defaults, color alpha 0: button 0, game 0.
- The same with alpha 0 through modulate: button 0, game 0.
- The same, hidden: the button was pressed.
- Mouse Filter Pass: button 0, game 1.
- Mouse Filter Ignore: the button was pressed.
- ColorRect set to Ignore, with a full-screen TextureRect and a Label inside left at their defaults: button 0, game 1. full_screen_catchers() listed the TextureRect. After apply(), which changed 1 Control, the button was pressed and the list was empty.
Why it happens
Mouse Filter decides whether a Control takes the mouse, not whether you can see it. In Godot 4.7 the default is Stop for ColorRect, Panel and a plain Control, Pass for TextureRect and Ignore for Label. A Control on top that takes the click keeps it from the Controls under it, so a fade that has gone fully transparent still eats every click. In our test Pass let the click through to the game's _unhandled_input(), but not to the button under it.
What to change
- You may want a fade to block clicks while it runs, so the player cannot press anything mid-transition. Then hide it, or set it to Ignore, when it finishes.
- A ColorRect made in code starts at Stop: set the filter right after ColorRect.new().
A full-screen shader over a 3D scene: post-process shader with depth. Fading between two backgrounds: visual novel background crossfade.
Ink looks and scene transitions: PD Ink Wash has a 2D full-screen ink layer and 8 ink brush scene transitions, and both create their ColorRect with Mouse Filter set to Ignore, so the buttons under them keep working.
Tested in Godot 4.7 with the Compatibility renderer.
Ready-made: PD Ink Wash has 12 ink looks for 3D, 2D full-screen and sprite shaders, and 8 ink brush scene transitions that let clicks through to your buttons.
More how-tos for PD Ink Wash: Full-screen post-process shader in 3D
More how-tos: UI and HUD
- A screen fade that finishes while the game is paused or slowed
- A hand of cards that always fits, without spreading out when it is small
- Edge markers that stay on the rim and point the true way
- A wrapped Label that is as wide as its text, up to a limit
- Big numbers with thousands separators, minus signs and all
- Show a 0 to 1 ratio on a progress bar, and fill a ring or gauge from the angle you want
- Blink or fade a tinted HUD element without losing its color
- Spin a HUD ring, radar or icon in place instead of around its corner
- 9-slice window: corners that do not stretch
- Visual novel background: fill the screen, crossfade scenes
- Coins that fly to the HUD counter
- Floating damage numbers in 2D
- An icon over a 3D character's head, without the ghost behind the camera
- Drag a box to select 3D units, in any direction
- Radar blips that turn with the player
- Pick the radial menu slot the mouse is pointing at
- Show a percent that never says 0% or 100% too early
- Type dialogue at the same letters per second on every line and every frame rate
- Place brush dots at the same spacing however fast the mouse moves
- Move a speedometer or gauge needle smoothly without cutting through the bottom
- A countdown that never shows 0 while time is left
- A coin counter that rolls up and lands on the real total