Topic was automatically imported from the old Question2Answer platform.
Asked By
xyzzyx
Old Version
Published before Godot 3 was released.
I have a background that is made as a sprite with a texture.
When I want to place a label now on top of the background I can only see the text of label when I move it outside of the background but not on the background.
The label seems to be behind the background.
But the label class does not have a value or a function to set the z position.
My solution was to set the z value of the background sprite to -1 then the label is in the foreground.
Are there also other solutions?
I know you’ve already answered this yourself, but for me the better solution was to create a Node2D element and child the UI elements to it. I did this because the Node2D has a z property and it can be hidden or shown at my discretion which the CanvasLayer didn’t. Useful when you want to show menu panels i.e. pause menu.
The problems I found with the CanvasLayer is that it can’t be hidden and if you display a panel over it, all of its children elements disregard your sort order and still show over eveything.