Skip to content

Instantly share code, notes, and snippets.

@ffreality
Created January 17, 2024 16:04
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/5d4b7aadfbb234d36370d1490436437c to your computer and use it in GitHub Desktop.
Save ffreality/5d4b7aadfbb234d36370d1490436437c to your computer and use it in GitHub Desktop.
Use Custom View
bool UWindowSystemBPLibrary::UseCustomGameView(UCustomGameView* GameViewWidget)
{
if (!IsValid(GameViewWidget))
{
return false;
}
SWindow& GameWindow = GEngine->GameViewport->GetWindow().ToSharedRef().Get();
TSharedRef<SWidget> ActualGameView = GameWindow.GetContent();
TSharedRef<SWidget> ParentWidget = GameViewWidget->TakeWidget();
ActualGameView->AssignParentWidget(ParentWidget);
GameWindow.SetContent(ParentWidget);
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment