[Feature Request] Change z-order of widget at runtime

Here’s the solution I thought of:
In my game, I switch between HUDs a lot (interactive novel). So I didn’t want to create any blueprint inside the event graph of my HUD or main canvas panel since that would change.


I started by binding to the hover and unhover event in my custom button (I’m using this button: link to unreal forum ).
Also, added an input variable to the binded events (of type Widget - Object reference) to which I plugged in a reference to the Self (right click “Get a reference to self”). (so that I can send that reference to the player controller)

(Note: the next step could be done in the HUD; Gamemode or Player controller) In my case, I don’t have a character so my player controller is what I use for this section. But usually you should be using the HUD.

  • In my case the event is called each time I change the canvas panel on-screen, which is why I clear the array at the beginning.
  • frontZOrder must be > to backZOrder (I put a default value of 30 this way I’m sure nothing else is in front of it.

Lastly, my animation and button effects are still in a separate function. (you don’t need to do this for it to work)

Cheers, hope it helped.