I’m using a Node2D (with a child Sprite2D) as a cursor in a level editor (mouse is hidden). When I open an OptionButton’s popup menu, said menu overlaps the cursor regardless of Z-order.
Example:
The cursor is that white cross.
Is there any way to fix this while still using a Node2D object as a cursor?
I’ve just tried it: made the cursor (the cross) a child of a canvaslayer set to layer 10 for good measure. Did not work. Same behaviour occurs, where my custom cursor overlaps the menu button but not the popup.
Popup menus seem to trump everything but the operating system cursor. Is this the case for anyone else?
As per the CanvasLayer documentation, embedded windows - of which Popup (and PopupMenu) is a child class - are placed on Z-Index 1024. Placing another CanvasItem on layer 1025 or higher should render it above the Popup; however I haven’t had the chance to test this myself. A separate CanvasLayer shouldn’t be necessary.
Z-ordering even up to 4,096 didn’t do it. It does seem have to be via the canvas ordering index rather than Z-index., which as far as I can tell can only be changed with the use of a canvasLayer(?). I didn’t see a way to change it for a lone canvas item, but it would be nice if there was one.
In Godot’s inspector, though, you can only set the canvas layer to n = 128 max. However, it can be set higher than that with a setter in code: