Skip to content

Instantly share code, notes, and snippets.

@ffreality
Created January 17, 2024 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ffreality/270fe5d6f169dc06385fe6f9cad8665d to your computer and use it in GitHub Desktop.
Save ffreality/270fe5d6f169dc06385fe6f9cad8665d to your computer and use it in GitHub Desktop.
Custom UMG
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