Add functionality to open a UWorld when clicking New Game button in main menu
This commit is contained in:
parent
085fd8ea46
commit
1f6d729d73
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "MainMenuUIWidget.h"
|
||||
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
void UMainMenuUIWidget::NativeConstruct()
|
||||
{
|
||||
Super::NativeConstruct();
|
||||
|
@ -30,7 +32,11 @@ void UMainMenuUIWidget::NativeConstruct()
|
|||
|
||||
void UMainMenuUIWidget::NewGameButtonOnClicked()
|
||||
{
|
||||
// TODO: Implement Functionality
|
||||
// TODO: Replace this is a menu to confirm the user wants to start a new game
|
||||
if (!NewGameLevel.IsNull())
|
||||
{
|
||||
UGameplayStatics::OpenLevelBySoftObjectPtr(GetWorld(), NewGameLevel);
|
||||
}
|
||||
}
|
||||
|
||||
void UMainMenuUIWidget::LoadGameButtonOnClicked()
|
||||
|
|
|
@ -38,6 +38,9 @@ public:
|
|||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
TSubclassOf<class UUserWidget> OptionsMenuWidget;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
TSoftObjectPtr<UWorld> NewGameLevel;
|
||||
|
||||
private:
|
||||
UUserWidget* currentNewGameWidget;
|
||||
|
||||
|
|
Loading…
Reference in New Issue