Create new SaveObject in NewGameButtonOnClicked
This commit is contained in:
parent
6a494261d7
commit
3ea7bc2dc4
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "MainMenuUIWidget.h"
|
#include "MainMenuUIWidget.h"
|
||||||
|
|
||||||
|
#include "NakatomiGameInstance.h"
|
||||||
#include "Blueprint/WidgetBlueprintLibrary.h"
|
#include "Blueprint/WidgetBlueprintLibrary.h"
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
#include "UI/LoadGameUserWidget.h"
|
#include "UI/LoadGameUserWidget.h"
|
||||||
|
@ -68,9 +69,11 @@ void UMainMenuUIWidget::NativeConstruct()
|
||||||
|
|
||||||
void UMainMenuUIWidget::NewGameButtonOnClicked()
|
void UMainMenuUIWidget::NewGameButtonOnClicked()
|
||||||
{
|
{
|
||||||
// TODO: Replace this is a menu to confirm the user wants to start a new game
|
|
||||||
if (!NewGameLevel.IsNull())
|
if (!NewGameLevel.IsNull())
|
||||||
{
|
{
|
||||||
|
UNakatomiGameInstance* gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld()));
|
||||||
|
gameInstance->CreateNewSaveGame("test1");
|
||||||
|
|
||||||
UGameplayStatics::OpenLevelBySoftObjectPtr(GetWorld(), NewGameLevel);
|
UGameplayStatics::OpenLevelBySoftObjectPtr(GetWorld(), NewGameLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue