Godot Version
Godot 4.3
Question
Hey all, looking for some help on determining the origin of a bug I’m encountering. I’m relatively new to Godot and trying to learn some more of the basics through a mix of trial-and-error and some Youtube video guides. Here’s the link to my project on GitHub, I tried slimming the issue down to just the core components of the issue as best I could. The branch is area2d-bug.
I originally tried zipping up my project and attaching it, but that didn’t work. Please let me know if there is a more proper way to request help.
Anyway, the big issue is that my Cards (Control nodes with Area2D detectors) in the Hand (HBox Container) are detecting the CardDropArea (Area2D) and emitting an _on_area_entered signal when the main scene is loaded. Then the _on_area_exited signal is not emitted until you click each of those cards. This point onward no cards, in Hand or not, are able to detect the CardDropArea.
One big thing I’ve noticed is that if you run TestLevelUpScreen as a standalone scene, it works as you’d expect with each card changing state based on what you are doing to it (Clicked, Dragging, Released, Aiming).
I believe the functionality changes when adding in the LevelOneManager as a parent of TestLevelUpScreen and LevelOne, but I’m left stumped as to why. I suspect it has something to do with CanvasLayer visibility being toggled on/off or with how scenes are layered, rendered, and drawn on ready.
To recreate:
(Unsure if breakpoints are maintained when importing projects)
- Add 2 breakpoints in card_ui.gd. Line 40 and Line 44
- Hit Run project and ‘Play’
- Line 40 breakpoints should activate 4 times in a row (one for each card)
- Hit ‘Skip’ button
- Moving one of the cards on the right (the ones in the Hand container) cause a Line 44 breakpoint to activate
- No cards detect the CardDropArea at all
Things I’ve tried:
Running standalone scene - no bug, card drop functionality remains (Awesome!)
Turning off the physics collision of CardDropArea - no bug, no card drop functionality
Reducing width of CardDropArea by around half - no bug, no card drop functinality.
In test_level_up_screeen.gd, removing commenting out line 7 - no bug, no card drop functionality.