How to handle UI swiching elegantly?

When there are 2 or more UIs, there are going to be UI switching (like web pages), and I know how to achieve that by using “add to view port” and “remove from parent”, but I haven’t figure out an elegant way to sort out all these switching logics, which ends up with a ton of events at Event Graph.

Usually, a fade in / fade out animation track that automatically plays whenever the widget is destroyed/added to the view-port.

Realistically, you should just create a master UI panel widget that you can then duplicate to do this.
The calls to “generate” and “remove” can be automated as functions, so within the widget you create a button and assign onclick “add this panel” which removes the current panel and adds in the new one.
In the new one you’ll have the same functions, so you can go back by calling “add this panel” on the click event of the back button.

Hope that makes sense.

Yes, that do make sense.
Also there are other issues, as the widget Blueprint cannot use things in the scene, so the only ways to operate scene actors via UI buttons are: 1) pass them into Widget object as variable, or 2) pack the button functions into Delegates and bind them outside, is that correct?

Generally you pass things to the widget. Like an actor, so you can get its location and spawn the widget on top of it. For instance.
To do this you can have a function or an event with a special signiature or I believe an interface call.

It really depends on where you initiate the widget from and what variables you have at your disposal there.
if you set things up on the level BP for instance you can use almost anything by just feeding the object into the function.

Do give interfaces a try. They made my life easier many times.

Would you like to share one of the circumstances that Interfaces makes your life easier? I know about the interface but I just don’t konow how to design. It’ll be so nice if you could share some of your samples.

Create an interface and add a pin to it.
apply the interface to an actor bp. Call in the function you created with the pins.
use the pins as you will.
add a collision sphere, set to overlap all.

In character BP add an overlap event for the capsule.
pull out from actor and find implements interface. Branch the bool off if. Call the interface function on true.

No need to cast anything. Plug in the variables you want to pass to the object. The object will respond and be provided with whatever variable you pinned.