UMG widgets ordering

When im adding widgets to CanvasPanel in UMG editor they dont respect displaying order.

21476-1.png

In example above i was adding Image widgets directly to canvas panel, each image was moved to the right and down. As you can see brown and light red images are drawn in bad order.

Even worse, when adding another image, order of those already added is mixed up:

21477-2.png

As you can see Turquoise image now is in front, and only thing i did was adding new image to canvas.

Am i doing something wrong? Z-Order in all of those images is default that is 0, and im aware that i can adjust their draw order by changing Z-Order but i think that images that are added in certain order, and are displayed in that order in hierarchy, should respect that hierarchy when drawing.

Also i dont see any way to change widget position in hierarchy (or to choose place where new widget should be in hierarchy). It seems like if i have 10 widgets on canvas and i want to swap hierarchy order of widgets 3rd and 7th only way is to remove them from parent and placing them once again in different order.

I’m curious about this as well! I’ve been learning UMG for a few weeks and this has plagued me ever since I started.

Hello Jakub Gałecki,

You would be correct in assuming that you will need to set the Zorder for everything on your Designer tab that overlaps. Hierarchy does not necessarily determine what shows as on top. As for rearranging widgets in the hierarchy, you will need to click and drag them. When dropped on a widget that can hold it as a child widget the widget will then be placed under it. You can also reorder the widget by clicking and dragging them upward in the hierarchy.

It seems to be a bug. UIs might be drawn in order in hierarchy among the same ZOrdered UIs. But in UE4 engine codes, I found codes not to preserve the order in hierarchy while trying to sort by ZOrder.

The codes are at SConstraintCanvas.cpp - 79 lines. (SConstraintCanvas::OnArrangeChildren, Engine Ver. 4.8.2)

SlotOrder.Sort(FSortSlotsByZOrder());

This line should be corrected to below.

SlotOrder.StableSort(FSortSlotsByZOrder());

After I rebuilt the engine, it worked in the way I thought.