CToolWidget
Overview
Widget creation and management utilities.
Functions
| Name | Description |
|---|---|
| spawnWidgetAtRuntime | Create a widget, call init lambda, add to viewport. Overloads with/without explicit UClass, with/without addToViewPort flag. |
| removeWidget | Remove a widget from the viewport. |
| sizeOfStringInPixel | Measure the pixel size of a string with a given font. |
// Spawn with default class
UMyWidget* w = spawnWidgetAtRuntime<UMyWidget>(myActor, [](UMyWidget* w) {
w->SetText("Hello");
});
// Spawn with explicit class, not added to viewport
UMyWidget* w2 = spawnWidgetAtRuntime<UMyWidget>(myActor, widgetClass, nullptr, false);
// Remove
removeWidget(myActor, w);
// Measure text
FVector2D size = sizeOfStringInPixel("Hello World", myFontInfo);