Widget Switcher problem

Hi!
I can’t figure out what I’m doing wrong with the “widget switch”.
I made a character toggle menu using the “posses” function.
The menu widget opens and closes with a space bar.
When I open the menu and switch to the character “walk” (under index 1), it works correctly, but as soon as I close and then reopen the menu, the widget switches back to (index 0).
This happens whenever I switch to another character and reopen the menu there.
How can I get the “widget switcher” to remember the current player selection?


But that’s not what you technically do. You create a brand new widget every time you use that input. Here, right?

image

We don’t even know what happens to the old widget. That’s a classic candidate for a memory leak.


Create the widget once, on Being Play. Then, show / hide it using the reference you created. Something along the lines of:

Okay, thanks, I’ll check it out now.
I can’t find this node
_

You don’t need it. Use the FlipFlop node like you did before:

It was just an example I’m used to.


The Select node is a wildcard node, the pins propagate type as soon as you plug a wire in:

But you can also change the type manually by right clicking pins:

It seems to work well.

Thank you very much!! :slight_smile:

Not sure whether you remove the widget from parent somewhere, but if you start seeing warnings in the log, it will be caused by re-triggering Add To Viewport a widget that already sits there.

If that manifests, have a closer look at what I posted, specifically at how the Begin Play’s execution flow is separate from the FlipFlop’s.

оK,оК thanks again very much for the help!