- A UI scene
- A character scene
- A Node2D that contains both the UI and a TileMapLayer node
In the UI scene, I have a TextureButton with an Area2D as its child node. The TextureButton has a script that basically does this:
When I press and drag the TextureButton over the TileMapLayer (which is in a specific group), the Area2D detects when the TileMapLayer body enters, and then the TextureButton should instantiate the character scene on a specific cell of the TileMapLayer.
The problem is: while the Area2D correctly detects the TileMapLayer, most of the time the TextureButton (which has a Sprite2D showing a card) doesn't instantiate the character scene. I have to drag the card (TextureButton) multiple times for the character scene to finally instantiate.
Hope this makes sense 😅