z order in widgets are only respected in the widget itself, not globally.
So if you create 2 userwidgets, one will always overwrite the other, dependent on creation order.
This hinders interaction like drag&drop between different widgets.
Z-Order should be in the hands of the user.
1.) Not too much in my project, so I consider it clean. Yes.
2.) I can:
a.) Create a UserWidget, add an image to it, name it UW1 and add it to the viewport
b.) Create a UserWidget, add an image to it, name it UW2 and add it to the viewport, make it overlap with UW1
c.) In the designer, change ZOrder of the image in UW1 to 10 so that it should be drawn after all widgets in UW2.
Result: image in UW1 is drawn under all widgets in UW2.
Expected Result: image should be drawn over all widgets in UW2, because it’s ZOrder is 10 and zOrder of all widgets in UW2 is 0.
3.) sorry, I think in this case a picture can’t help.
4.) this works, but it’s more of a workaround. Leaving the ZOrder in the users hand allows for more freedom. Perhaps I might suggest, that the menu itself (top most Canvas Panel) gets a ZOrder? So menus can be ordered by user.
The zoder is for organizing widgets within the widget itself. This feature does not extend globally to all widget blueprints. To determine what widget blueprint will be on top you will need to know which was added to the viewport last. This means that another workaround could be to remove the widget that you want on top and to immediately add it back when ever another widget blueprint is added. With that being said there is a feature request that has been implemented on an internal build that will allow for more control over the layering of widgets. This feature will be available in a later release of the engine. I hope that this information helps.
I just realize that I need that feature too. I open several windows with UMG and they appear in different Z orders depending on when they were opened. I would much like to be able to set the Z order of a user widget myself. Can we get some info about this feature request and when it may be considered?
I have a couple of suggestions for you that may help depending on your needs. I hope this information helps.
Suggestions:
You could have one master widget that all other widgets are added to so that you can set their Z orders dynamically at children of the the Master Widget’s canvas
You can manage the z order when adding the widgets to the viewport by clicking the little down arrow one the “Add to viewport” node. This would allow you to manage the zorder for the widgets as they are added to the screen.
man… this is a great idea.
Probably never saw it because of big tomatoes on my eyes.
My current solution is to mix Menus created in BP and created by cpp using AddToViewport(). There are a lot of side effects and code converting coords going on to make this work. But overall design is overly complicated so far. I’ll try this out. Probably setting the anchors to all 4 corners (for the master menu) should also help with resizing windows.
this doesn’t seem to work I set my player HUD to 0 upon adding it to my viewport and my other widget to 100 when added and it’s still behind the HUD