"Alt + Up/Down" for GO draw order inside collection

Problem:
Creating the game level (scene) inside Defold. Suppose we have a collection for the level and lots of GO with sprite and spine component for backrounds, tiles, objects, etc. Cool. How we can change a draw order of this Go? Answer: create a pseudo layers with different z-index for backgrounds, objects, front, etc. Cool. But what if we have tons of objects inside a layer? First placed object is equal to first rendering Go within layer. No able to change draw order except manual tuning of z by input this value as numbers. It’s not cool.

For example at this image I want to make “a” behind “b”:

In GUI system we can select a node and press Alt + Up/Down to move a node up or down and change its index order. In collection we aren’t. List of objects in outline are ordering by alphabet (btw, what’s benefit of this?), but not the draw order.

So, feature request:
How about to make the same behaviour of sortering as we have in GUI? I mean change the draw order of object inside a list of all objects with the same Z-index.

23 Likes

I agree with Dragosha. Have same problem. :cry:

4 Likes

Would be cool as an option. Likewise with GUIs be able to toggle them to use their z for sorting.

4 Likes

Very useful feature! Vote up!

1 Like

Would be very nice! Not only for changing draw order but for better organizing. If I want to locate some connected components/go’s together, now I would have to add common prefix to their ids.

Really nice idea, and very useful for quick development. Please add this things. Thank you for your work!

Agree, would be nice to have such feature

+1 To have this feature

+1

must have +1

+1

Game objects are rendered based on z-value. What’s the actual proposed change here? That we sort list by z-value instead of alphabetically and provide a keyboard shortcut to move one object above/below another by changing the z-value? If so, by how much?

1 Like

I mean we need the ability to change the order of GOs in collection, not Z-value.
Collection is text file where game objects are “nodes”, and first included will first in render list. So, if we have able to change the order we can tuning the render list of objects with same Z whitout of changing this Z-value.

Oops, I’ve tried to make screencast to illustrate the idea and noticed that render list is different in editor and runtime.

2 Likes

If two components have the same z-value the order is undefined. There are rules of course but you shouldn’t rely on this in any way.

1 Like

Changing go order, will be change init order. In some cases it can be useful

1 Like

I tried the same things myself. With more than two objects, changing their order in the collection file doesn’t seem to have predictable results.

It’s not what everyone here is asking for, but I think it would be very useful to expand the existing “nudge” arrow key commands in the editor to include Alt + Up/Down for nudging the Z value. There would need to be a option in the preferences to set the increment.

good idea

1 Like

I think what people are asking here is for the z-ordering sort to be a stable sort and maintain the collection order when two components have the same Z. But the problem here is that operations are being made on that Z value and floats are lossy, so, for example, a GO at Z = 0.1 with a sprite inside it at Z = 0.2 might not fall into the same stable sort bucket as a GO at Z = 0.3 with a sprite at Z = 0.0, because 0.1 + 0.2 equals 0.30000000000000004, which is different from 0.3.

2 Likes

This is what we’ve discussed internally as well then this discussion had come up before.