godot icon indicating copy to clipboard operation
godot copied to clipboard

InputEvent runs twice if object is a child of CanvasLayer Node

Open Morphinometr opened this issue 2 years ago • 2 comments

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…

Morphinometr avatar Aug 20 '22 09:08 Morphinometr

Sample project: test4.zip

Morphinometr avatar Aug 20 '22 09:08 Morphinometr

Correction, if Area2D is a child of CanvasLayer event hits twice too. I forgot to make it child

Morphinometr avatar Aug 20 '22 11:08 Morphinometr

I had the same problem. Any updates here? Is there a workaround? version: Godot 4.0 beta7

chainzhang avatar Dec 08 '22 13:12 chainzhang