[UMG] Remove Widget isn't working when i press button.
i have a Widget that represents my Singeplayer Game Creation Menu. I list the savegames there. I get all Savegames in the Construct node of the Singleplayer Menu and create a new Widget called "Savegame" for each. They are set as a child of a Vertical Box inside a Scrollbox. This all works fine.
Now my problem:
The Savegame Widget has a Button to delete the Savegame. This is working too, but i can't get the Widget removed from the Singleplayer Menu. Its only gone if i go out of the menu and go back in (so only if construct is called again).
For the button i tried several things. I used the remove from viewport node for the Savegame widget. I got the Parent of the widget and removed it child (self), but nothing is working. The Widget stays activ until i reload the Singleplayer Widget. Is there a method to reload a widget or why is the Savegame widget not disappearing?
The SaveGameWidget button Method:
And the Singeplayer Constuct Node:
If you use Add Child, you need to get your Parent and call RemoveChild(self). In 4.5 there's just going to be a call you can make RemoveFromParent on any widget. Both these calls are separate from Add/Remove From Viewport, which is akin to saying, spawn this widget in a new window.
answered Aug 20 '14 at 12:49 PM
Nick Darnell ♦♦ STAFF
This may have no bearing on your issue ... but I was just doing something like that. I used Add To Viewport and Removed From Viewport for the widget in GameState and that worked. Your calls to SaveGame probably should also be in GameState anyway. You can use an Interface Messenger function to send from your widget back to gamestate.
answered Aug 20 '14 at 12:23 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here