Need to set z-order of HUD

I have a custom blueprint widget that displays a special crosshair. It gets added to the screen using AddToViewport as part of the BeginPlay function inside the HUD blueprint. The problem is that it’s wiping out all of the other HUD elements. The crosshair widget needs to be drawn first and all the other HUD elements need to be drawn on top of it. Unfortunately, setting the ZOrder on the crosshair doesn’t seem to do anything. Is there a way to fix this?

Hi Whammy,

the ZOrder is the correct option, make sure to set the order in ascending value, the higher number items will appear over the lower order items, so 0 should be the background and the crosshair will need to be at least 1, if not higher depending upon what other widgets are in the HUD.

The problem is that the crosshair appears on top of the HUD which is obliterating much of the HUD content. The crosshair widget needs to appear underneath the other HUD elements.

Increase the zorder of the other HUD widgets if they are in the same general widget, this should draw them over the crosshairs as you are describing.

Well, that’s the problem. The basic HUD elements such as DrawText and DrawTexture do not have any provisions for setting the z-order.

No, but the containers that you might want to put around them, or the whole widget you create can have higher values.

If the crosshair has a lower one, then you just need to set the topmost widget in the hierarchy of the other widgets higher.

At least that’s what i think it should be :X

Maybe give some insights on how you setup the widgets. Then it’s easier to solve (: