关键字:Runtime、TextRender、TextRenderActor

This is an image

代码:

#include "Engine/TextRenderActor.h"
#include "Components/TextRenderComponent.h"

void ATopDownTestGameMode::BeginPlay()
 {
     Super::BeginPlay();

     Text = GetWorld()->SpawnActor<ATextRenderActor>(ATextRenderActor::StaticClass(), FVector(0.f, 100, 170.f), FRotator(90.f, 180.f, 0.f));
     Text->GetTextRender()->SetText(FText::FromString(TEXT("Dynamic Text")));
     Text->GetTextRender()->SetTextRenderColor(FColor::Red);
     Text->SetActorScale3D(FVector(5.f, 5.f, 5.f));
 }