Hello,
iam trying to save/load game but my actor location is 0, 0, 0 (LoadGameInstance->PlayerLocation) when i saved location for example 1000, 400, 400…
I tried 3 tutorials for savE/load but same result
void AMyCharacter::LoadGame()
{
UMySaveGame* LoadGameInstance = Cast<UMySaveGame>(UGameplayStatics::CreateSaveGameObject(UMySaveGame::StaticClass()));
LoadGameInstance = Cast<UMySaveGame>(UGameplayStatics::LoadGameFromSlot(SlotName, 0));
RootComponent->GetOwner()->SetActorLocation(LoadGameInstance->PlayerLocation);
}
void AMyCharacter::SaveGame()
{
UMySaveGame* SaveGameInstance = Cast<UMySaveGame>(UGameplayStatics::CreateSaveGameObject(UMySaveGame::StaticClass()));
SaveGameInstance->PlayerLocation = RootComponent->GetOwner()->GetActorLocation();
UGameplayStatics::SaveGameToSlot(SaveGameInstance, SlotName, 0);
}
Am i doing something wrong please?
Thankyou for any advice.