Is There Any Way to Identify the Order in Which Widget BPs are Rendered on to the Viewport?

Hey guys,

For instance I have 3 widget blueprints, BP1, BP2 and BP3.

And if I do,


In this case, in the end I will be able to see BP3 on the viewport, the other two will be behind BP3. But is there any way to identify using C++ which widget is currently being rendered at the top?

Please do reply.

Thank you.

Not sure about the c++ function, but blueprint does deliver an index parameter to handle this.

Thank you for your reply. But that only applies for widgets right? How about User Widget blueprint? I have multiple user widget blueprints and I want to identify the order in which they are rendered on to the viewport?

Sorry, was half asleep while reading your thread, i have thought you want to set the Z Order, not to identify the top one.
I know there’s a “Get Z Order” function, but it’s only for a canvas panel slot.
Couldn’t find a function in the documentary to get the top visible widget, sorry.

If you are not setting that order then I believe there is some root object and widgets are rendered in the order in which they are stored in that “root”. Check c++ AddToViewport code for details.
But better set correct Z order.

z order sorting

By default it will render the userwidget bp at the top most layer.
The thing that I am trying to achieve is to implement back functionality.

The solution that I have found is using a stack of widgets.

Hopefully this may help some one in the future.

TArray<UUserWidget*> WidgetStack;


if (!TestWidget ){
    TestWidget = CreateWidget&lt;UTestWidgetController&gt;(GetWorld(), TestWidgetRef);

if (!TestWidget)

if (TestWidget-&gt;IsInViewport())
    int32 index = WidgetStack.Find((UUserWidget*)TestWidget);


If we use Widgetstack in this way, It may be used to get the order in which widgets are rendered on to the viewport.

hi,i have the same problem,i want to get the UserWidget rendering at the top。but the widget is not created by me。so,i can’t eidt the code of the widget。
do you find the way to identify the top userwidget?

please do reply。best wishs!!!