Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 492 Bytes

Creating HUD in C++.md

File metadata and controls

28 lines (21 loc) · 492 Bytes

2020-08-06_13:52:59

Creating HUD in C++

AMyHUD::AMyHUD()
{
    static ConstructorHelpers::FClassFinder<UUserWidget> Widget_BP(
        TEXT("/MyHUD/BP_MyHUDWidget"));
    MyHUDWidgetClass = Widget_BP.Class;
}
void AMyHUD::BeginPlay()
{
    Super::BeginPlay();
    check(MyHUDWidgetClass);
    UUserWidget* MyHUDWidget = CreateWidget(GetWorld(), MyHUDWidgetClass);
    check(MyHUDWidget);
    MyHUDWidget->AddToViewport();
}

UUserWidget is child of UWidget.