Download

UMG. How to raise an image for z-order?

Hello all!
I made some UI-screens with UMG. This is awesome tool! And I made a custom cursor with this tutotialhttps://wiki.unrealengine.com/How_to_Setup_Custom_Crosshair_/_Cursor. It really helps! But my custom cursor is hidden by UI background image. My answer is: how to raise an image for z-order?
Every object in UMG has a Z-order property, but a custom cursor is drawn by Blueprint and I don’t how to raise it.
Any help will be great, thank you!

Are you drawing the Cursor in your HUDBP from something like DrawTextuer?

Yes, you’re right

i think thats not possible in bp as far as i tested this stuff umg is allways drawed ontop of everything. But you can create a new Widget with an image inside wich will be your cursor. SetPositionInViewport is your friend in this case

i made as you said but it’s not help, can you explain this, may be i do wrong

You need to add the cursor widget to the viewport after all other widgets are added

Ive made you an example but in order to use it you need to do the following things.

  • You need the Main widget wich holds all your stuff (I called it UserInterfaceWidget)
  • You will need a Widget with an just an ImageControl set to your cursor (We call this Widget CursorWidget)
  • In your PlayerController add 2 new variables 1 for the UserInterfaceWidget and one for the CursorWidget
  • You need a Hud Blueprint :slight_smile:

949dfc7bd4322861e3b48c10ce592c3bc3488d5a.png

If you have other variables names this is ok but be sure to use your names

Same for the Casting to the Player Controller class (mine is called MyPc)

I personally dont like working with the HUD Class BLueprint because you dont really need it.

Thank you very mach!
Unfortunately, I can’t release the second part that about HUD Blueprint, my Player Controller isn’t complete with Cursor Widget.

I cannot connect Cast to PlayerController with Set Position in Viewport, how to make a node between them?
Background image is created as target but Cursor image isn’t. Why?

Drag of a Wire from your Cursor Widget reference

it doesn’t make anything (

well, it’s all good, thank you

You said that you don’t like to use the HUD Class BLueprint, how do you make a custom cursor else?

I got a UserInterfaceWidget wich then adds everything as child widgets etc