Overlapping TextureButtons and InputEventScreenTouch fail to trigger the button on top
I am making a game with jigsaw pieces I can move around by dragging.
Every piece is a Node containing a child with a TextureButton.
It works pixelperfect to click the jigsaw pieces, dragging them around and so on. The problem is when two pieces are overlapping.
When I touch/click in the area were the two pieces are overlapping I want the piece on top to react. But it is always the piece that is loaded latest in the tree that reacts, regardless if it is on top or not. So if that piece happen to be below, it is grabbed still and the topmost piece is ignored.
The pieces are generated dynamically of course, so I tried moving them around in the scene tree, changing places in the tree but it does not work. It is always the node that was originally the latest in the tree that gets the input event, regardless if it is now in a new position in the tree or not. z ordering does not make a difference. I have tried various mouse filters (ignore, stop, pass) and they make no difference.
Anyone have any thoughts about this behaviour?
I'd rather not write a custom global clickhandler, sorting pieces by z-order, comparing pixels to a click bitmap etc. unless I have to.
I am using Godot 3.5.1