Skip to content

Sein World Widget Pool

Class · USeinWorldWidgetPool : UObject

#include "Utility/SeinWorldWidgetPool.h"

Reuses widgets for per-entity screen-space UI such as unit banners. Initialize it with a panel and a widget class, then each tick call Release All and Acquire for every entity that is visible, and position each returned widget yourself. Acquired widgets are not given an entity context; if they are Sein Entity Widgets, call Set Entity Context on them.

Initialize the pool.

Defaults: InitialPoolSize = 20.

void Initialize(UPanelWidget* InParent, TSubclassOf<UUserWidget> InWidgetClass, int32 InitialPoolSize = 20);

Gets the widget for an entity, reusing its current one if it has one, otherwise taking one from the pool or creating a new one, and makes it visible without taking mouse input. Returns none for an invalid entity or before the pool has a parent panel and widget class.

UUserWidget* Acquire(FSeinEntityHandle Entity);

Hides the entity’s widget and returns it to the pool.

void Release(FSeinEntityHandle Entity);

Release all active widgets back to the pool.

void ReleaseAll();

Get the active widget for an entity. Returns nullptr if not active.

UUserWidget* GetActiveWidget(FSeinEntityHandle Entity) const;

Get the number of currently active widgets.

int32 GetActiveCount() const;

Get the total pool size (active + inactive).

int32 GetTotalCount() const;