engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 所有成员列表
FUserWidgetPool结构体 参考

Pools UUserWidget instances to minimize UObject and SWidget allocations for UMG elements with dynamic entries. 更多...

#include <UserWidgetPool.h>

Public 成员函数

void AddReferencedObjects (FReferenceCollector &Collector)
 Report any references to UObjects to the reference collector (only necessary if this is not already a UPROPERTY)
 
template<typename UserWidgetT = UUserWidget>
UserWidgetT * GetOrCreateInstance (TSubclassOf< UserWidgetT > WidgetClass)
 Gets an instance of a widget of the given class. 更多...
 
template<typename UserWidgetT = UUserWidget>
UserWidgetT * GetOrCreateInstance (TSubclassOf< UserWidgetT > WidgetClass, WidgetConstructFunc ConstructWidgetFunc)
 Gets an instance of the widget this factory is for with a custom underlying SObjectWidget type
 
void RebuildWidgets ()
 Triggers RebuildWidget on all currently active UserWidget instances
 
void Release (TArray< UUserWidget * > Widgets, bool bReleaseSlate=false)
 Return a widget object to the pool, allowing it to be reused in the future
 
void Release (UUserWidget *Widget, bool bReleaseSlate=false)
 Return a widget object to the pool, allowing it to be reused in the future
 
void ReleaseAll (bool bReleaseSlate=false)
 Returns all active widget objects to the inactive pool and optionally destroys all cached underlying slate widgets.
 
void ReleaseAllSlateResources ()
 Reset of all cached underlying Slate widgets, but not the active UUserWidget objects
 
void ReleaseInactiveSlateResources ()
 Reset of all cached underlying Slate widgets, only for inactive widgets in the pool.
 
void ResetPool ()
 Full reset of all created widget objects (and any cached underlying slate)
 
void SetWorld (UWorld *OwningWorld)
 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.
 

详细描述

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

参见
UListView
UDynamicEntryBox

成员函数说明

◆ GetOrCreateInstance()

template<typename UserWidgetT = UUserWidget>
UserWidgetT * FUserWidgetPool::GetOrCreateInstance ( TSubclassOf< UserWidgetT >  WidgetClass)
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.


该结构体的文档由以下文件生成: