Godot Version
4.2.1
Question
I have the following scene:
with the following script attached:
class_name Card_Debug
extends Control
func _on_drop_point_detector_area_entered(area):
print("Card debug: area entered")
Here is my main scene:
with the following script attacked:
extends Node2D
@onready var card_debug = $Card_debug
func _process(delta):
# Move the card_debug object slowly for testing so that the area2ds will collide
card_debug.global_position.x += 1
func _on_static_area_2d_area_entered(area):
print("Static area 2d entered")
The problem is that the “Card_Debug: Area entered” signal is being fired, but the “static area 2d: Area Entered” signal is not. I need both signals to fire.
It seems to me like this problem has something to do with the Card_debug/DropPointDetector being defined in the “Card_Debug” scene rather than being a child of the Card_debug instance that is defined in the main scene. If I manually create a node that has the same structure as the Card_debug scene, then both signals work correctly. For example:
extends Node2D
@onready var test_control_obj = $TestControlObj
func _process(delta):
# Move the object slowly for testing so that the area2ds will collide
test_control_obj.global_position.x += 1
func _on_static_area_2d_area_entered(area):
print("Static area 2d entered")
func _on_test_area_2d_area_entered(area):
print("Test area 2d entered")
with this as my main scene, both signals fire properly.