Dear Community,
The way to remove all widgets of certain classes is to use
GetAllWidgetsofClass -> For Each - > Remove From Viewport
I contributed GetAllWidgetsOfClass to the Engine early in UE4’s development, and offered RemoveAllWidgetsOfClass as well, but Epic preferred people to make their own blueprint library to add this second node.
GetAllWidgetsOfClass
https://github.com/EpicGames/UnrealEngine/pull/569
RemoveAllWidgetsofClass
https://github.com/EpicGames/UnrealEngine/pull/587
(must logged into your ue4-linked github account to see above links
#Design Idea For You
I make my own UUserWidget base class that I inherit all my game widgets from, so I can just call GetAllWidgetsOfClass on my custom base widget class, to remove all of my widgets at any time ![]()
So in Editor
Create-> UserInterface → Widget and just give it a name like MyBaseWidget
Then File → Reparent all of your widgets to this BaseWidget class / BP and then you can easily clear your UI at any time using GetAllWidgetsOfClass(BaseWidget) (All in BP)
#![]()
Rama