Gui seems to ignore layer in Editor and in-game DEF-2878

I have a parent node with three children, and one of the three children isn’t rendering at the right z-layer, neither in the editor nor in the game. Some info:

  • I know the z-position isn’t important, but they all have it set to 0
  • the parent is assigned to a layer. None of the children are.
  • None of them have a material assigned.
  • None of the nodes have clipping enabled, although the troublesome node has some children which do some clipping
  • it’s not a problem with alpha.
  • The specific problem is that one node appears behind the others, no matter where I move it in the list on the right.
1 Like

Hi @88.josh.
Could you perhaps provide a small repro for this?

Okay, the project itself is still very minimal. If you open the GUI scene and look at the contents of the node called “ls1”, and try moving the order around, you’ll see that “cover1” is always rendered at the back, both in the editor and the game.

mytutle.zip (266.1 KB)

and THANK YOU! for offering to take a look at this.

Hmm, it has something to do with the layers. If you change the parent node’s layer from “gui1” to the default layer then it works correctly. I’m not sure why that happens though.

Okay, I think I should be able to workaround this.

@ross thank you for investigating. I had got just as far as figuring out it was something to do with layers, but that’s the limit of my knowledge, I’m afraid. Hopefully mathias will be able to help out.

Merry christmas everyone!
I’m going to spend some more time with my family now.

Layers and stencils doesn’t work well together. You used stencils as well didn’t you?

“A clipping node and its hierarchy will be drawn first if it has a layer assigned and in the regular order if no layer is assigned.”

1 Like

Okay, that’s enough time with my family.

The problem disappears if no layer is assigned to the parent node that encompasses all the nodes. So, britzl is right, but I would have to describe it as a bug. REPORTED HERE: https://github.com/defold/editor2-issues/issues/2878

I have one other problem with clipping: I wish it were the case that child nodes clip their parents. Rather than having to create a parent which is the clipper and then the child which is the “main” node. I am not sure what advantage there is of doing it this way.

And whilst I am complaining, I dearly, dearly, wish that I could actually save and store colors in the “custom colors” box. My custom colors seem to disappear all the time.

I would also ask to the wishlist: the option to add shadows and outlines to nodes in the same way you can add them to text.

and finally: I wish i knew more about shaders but i guess that one is on me.

1 Like

if anyone can think of a workaround or any other ways of accomplishing this, I would be very grateful. basically: I need to have a node with clipping rendered on the top of everything else.

One thing that I could do is somehow make it so that nodes with no layer assigned are automatically on top of those with a layer assigned, instead of the current system (nodes with no assigned are rendered first, followed by the layers specified in the GUI scene).