UnrealScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a custom widget"
#include "MyWidget.h" #include "Components/TextBlock.h" void UMyWidget::NativeConstruct() { Super::NativeConstruct(); // Get the text block component TextBlock = Cast<UTextBlock>(GetWidgetFromName(TEXT("TextBlock"))); if (TextBlock) { TextBlock->SetText(FText::FromString("Hello World!")); } } void UMyWidget::SetText(FString Text) { if (TextBlock) { TextBlock->SetText(FText::FromString(Text)); } }