In an unreal project, I have actors that have a widget component set to screen space. The widget assigned is a composite of an active state and an inactive state handled via a widget switcher. There’s also an HUD widget added to the viewport. I need to set the rendering priority of the actor widgets to be rendered on top of the inactive ones (for example, the z-index of the inactive widgets to be on less than the ones of the active widgets) and preferably I would also like to have the HUD to always render on top of everything. I have tried setting the priority of each widget in its widget blueprint and the translucency sort priority on the widget components when the active state of the actor changes, but was not able to achieve the desired result. Any help or reference to this would help tremendously.
Steps to Reproduce
Hi,
The HUD should always render above any world-space widget components, so you shouldn’t need to worry about that (unless you needed world-space WCs to render above the HUD, which would be a bit trickier). For the active/inactive sorting, the best approach would likely be to create two separate layers and host the active and inactive widgets in the separate layers. The downside of that approach would be requiring two widget components per actor, which might not be a problem unless you have a massive number of actors on-screen. Essentially, each actor would have a WidgetComponent with an ActiveWidget set to the ActiveWidgetLayer and an InactiveWidget set to the InactiveWidgetLayer, where the z-order of those two layers is set appropriately. Under the hood, we’ll match up those layer labels and create two total layers, one for all the active widgets and one for all the inactive widgets, and you could switch between the two by toggling the activation state of both widget components. Would an approach like that work for you?
Best,
Cody
Hi Cody,
Thanks for your swift response. Yes, this is exactly what I’m looking for as a behaviour. I handle state on the widget component, so it would have been useful to have that working with a single widget, but this option can work too for sure, although it will require some refactoring and handling on the actor component.
Many thanks for your help!
Kind regards,
Lefteris