![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <UserWidgetPool.h>
Public Types | |
| using | WidgetConstructFunc = TFunctionRef< TSharedPtr< SObjectWidget >(UUserWidget *, TSharedRef< SWidget >)> |
Pools UUserWidget instances to minimize UObject and SWidget allocations for UMG elements with dynamic entries.
Note that if underlying Slate instances are released when a UserWidget instance becomes inactive, NativeConstruct & NativeDestruct will be called when UUserWidget instances are made active or inactive, respectively, provided the widget isn't actively referenced in the Slate hierarchy (i.e. if the shared reference count on the widget goes from/to 0).
WARNING: Be sure to release the pool's Slate widgets within the owning widget's ReleaseSlateResources call to prevent leaking due to circular references Otherwise the cached references to SObjectWidgets will keep the UUserWidgets - and all that they reference - alive
| using FUserWidgetPool::WidgetConstructFunc = TFunctionRef<TSharedPtr<SObjectWidget>(UUserWidget*, TSharedRef<SWidget>)> |
|
default |
| FUserWidgetPool::FUserWidgetPool | ( | UWidget & | InOwningWidget | ) |
| FUserWidgetPool::~FUserWidgetPool | ( | ) |
| void FUserWidgetPool::AddReferencedObjects | ( | FReferenceCollector & | Collector | ) |
Report any references to UObjects to the reference collector (only necessary if this is not already a UPROPERTY)
| FUserWidgetPool::GENERATED_BODY | ( | ) |
|
inline |
|
inline |
Gets an instance of a widget of the given class. The underlying slate is stored automatically as well, so the returned widget is fully constructed and GetCachedWidget will return a valid SWidget.
|
inline |
Gets an instance of the widget this factory is for with a custom underlying SObjectWidget type
|
inline |
| void FUserWidgetPool::RebuildWidgets | ( | ) |
Triggers RebuildWidget on all currently active UserWidget instances
| void FUserWidgetPool::Release | ( | TArray< UUserWidget * > | Widgets, |
| bool | bReleaseSlate = false |
||
| ) |
Return a widget object to the pool, allowing it to be reused in the future
| void FUserWidgetPool::Release | ( | UUserWidget * | Widget, |
| bool | bReleaseSlate = false |
||
| ) |
Return a widget object to the pool, allowing it to be reused in the future
Returns all active widget objects to the inactive pool and optionally destroys all cached underlying slate widgets.
| void FUserWidgetPool::ReleaseAllSlateResources | ( | ) |
Reset of all cached underlying Slate widgets, but not the active UUserWidget objects
| void FUserWidgetPool::ReleaseInactiveSlateResources | ( | ) |
Reset of all cached underlying Slate widgets, only for inactive widgets in the pool.
|
inline |
| void FUserWidgetPool::ResetPool | ( | ) |
Full reset of all created widget objects (and any cached underlying slate)
| void FUserWidgetPool::SetDefaultPlayerController | ( | APlayerController * | InDefaultPlayerController | ) |
In the case a pool has no owner widget, a default player controller can optionally be specified allowing greater control
in split screen scenarios. The following priority rules are applied when determining the controller which should own created widgets: Controller of owning widget (if set) > Default player controller (if set) > First local player controller from world.
In the case that you don't have an owner widget, you should set a world to your pool, or it won't be able to construct widgets.