← Pixel Dreamer Studio

Make buttons clickable again under a full-screen fade, transition or post-process ColorRect

A ColorRect takes the mouse by default, even when you cannot see it. Set it, and every Control inside it, to Ignore.

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.

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

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