Created
January 17, 2024 15:58
-
-
Save ffreality/270fe5d6f169dc06385fe6f9cad8665d to your computer and use it in GitHub Desktop.
Custom UMG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UCustomGameView::UCustomGameView(const FObjectInitializer& ObjectInitializer) | |
: Super(ObjectInitializer) | |
{ | |
} | |
void UCustomGameView::NativeConstruct() | |
{ | |
Super::NativeConstruct(); | |
} | |
void UCustomGameView::NativeTick(const FGeometry& MyGeometry, float InDeltaTime) | |
{ | |
Super::NativeTick(MyGeometry, InDeltaTime); | |
} | |
TSharedRef<SWidget> UCustomGameView::RebuildWidget() | |
{ | |
TSharedRef<SWidget> Widget = Super::RebuildWidget(); | |
UPanelWidget* RootWidget = Cast<UPanelWidget>(GetRootWidget()); | |
if (RootWidget && WidgetTree) | |
{ | |
this->CanvasPanel = WidgetTree->ConstructWidget<UCanvasPanel>(UCanvasPanel::StaticClass(), FName(TEXT(""))); | |
RootWidget->AddChild(this->CanvasPanel); | |
this->OverlayWidget = WidgetTree->ConstructWidget<UOverlay>(UOverlay::StaticClass(), FName(TEXT(""))); | |
CanvasPanel->AddChild(this->OverlayWidget); | |
} | |
return Widget; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment