godot
godot copied to clipboard
InputEvent runs twice if object is a child of CanvasLayer Node
Godot version
v4.0.alpha14.official [106b68050]
System information
Windows 11 Vulkan GeForce 3060 Laptop
Issue description
I have an scene object with Area2D and collision shape. It's input_event signal runs twice if this object is a child of CanvasLayer. If I put it directly under root node it runs once. If I make an Area2D node directly in scene signal runs once too. In Godot 3.5 in the same project in all cases it runs once.
extends Node2D
@export var id := 0
func _on_Area2D_input_event(viewport, event, shape_idx):
if event is InputEventMouse and event.is_pressed() :
prints("Hit!", id)
Steps to reproduce
Open the sample project, run it and click on icons. Check the output.
Minimal reproduction project
Uploading test4.zip…
Sample project: test4.zip
Correction, if Area2D is a child of CanvasLayer event hits twice too. I forgot to make it child
I had the same problem. Any updates here? Is there a workaround? version: Godot 4.0 beta7