**New UMG Node
Get Widgets of Class
Ideal for UMG Level Transitions**
I needed node for Solus and so I am now sharing it with you!
The was that I could not save a reference to my new widget because it is loaded and then a level change occurs which resets my HUD variables.
So I needed to access the widget after it was created dynamically, not relying on stored references within the HUD class.
I also did not want to have to store a reference to it in my Game Instance class cause then that leads to garbage collection issues.
I had to make the node for my own use and I have tested it as working in Solus!
**Now you can retrieve an array of any type of user-made UMG widget that is currently in your game at any!
**
**Download**
https://wiki.unrealengine.com/File:VictoryPlugin.zip
C++ Code
Here’s what my C++ for node looks like!
void UVictoryBPFunctionLibrary::GetAllWidgetsOfClass(UObject* WorldContextObject, TSubclassOf<UUserWidget> WidgetClass, TArray<UUserWidget*>& FoundWidgets)
{
//Prevent possibility of an ever-growing array if user uses in a loop
FoundWidgets.Empty();
//~~~~~~~~~~~~
if(!WidgetClass) return;
if(!WorldContextObject) return;
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject);
if(!World) return;
//~~~~~~~~~~~
for(TObjectIterator<UUserWidget> Itr; Itr; ++Itr)
{
if(Itr->() != World) continue;
//~~~~~~~~~~~~~~~~~~~~~
if(Itr->IsA(WidgetClass))
{
FoundWidgets.Add(*Itr);
}
}
}
**Pic**
(right click -> open in new tab to see it better)

Enjoy!