Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputEvent runs twice if object is a child of CanvasLayer Node #64652

Closed
Morphinometr opened this issue Aug 20, 2022 · 3 comments · Fixed by #66076
Closed

InputEvent runs twice if object is a child of CanvasLayer Node #64652

Morphinometr opened this issue Aug 20, 2022 · 3 comments · Fixed by #66076

Comments

@Morphinometr
Copy link

Godot version

v4.0.alpha14.official [106b680]

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
Copy link
Author

Sample project:
test4.zip

@Chaosus Chaosus added this to the 4.0 milestone Aug 20, 2022
@Chaosus Chaosus moved this to To Assess in 4.x Priority Issues Aug 20, 2022
@Chaosus Chaosus moved this from To Assess to Todo in 4.x Priority Issues Aug 20, 2022
@Morphinometr
Copy link
Author

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

@chainzhang
Copy link

chainzhang commented Dec 8, 2022

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

@akien-mga akien-mga modified the milestones: 4.0, 4.x Jan 31, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in 4.x Priority Issues Feb 1, 2023
@akien-mga akien-mga modified the milestones: 4.x, 4.0 Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants