Make control nodes render on top of/below 2D nodes?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Fupicat

For this top down game, and I want the player to be able to place rooms wherever they want, and however big they want. The NinePatchRect node seems perfect for this, since I can resize textures and they retain their quality, but obviously NinePatch is a Control node, so I can’t change its z index.
The problem is, I need the player to be able to go behind the wall. I currently set the player’s z index as their y position every frame. All the NinePatchRects are stuck at a z index of 0, so my player is always above them. Any idea on how I can make this work?

My setup.
My setup.

Ingame
In-game. The player is supposed to be hidden behind the wall.

:bust_in_silhouette: Reply From: Fupicat

I actually solved it myself! If you make the control node a child of a 2D node, and alter the 2D node’s z index, the control node will also have it.