UGameplayStatics::LoadGameFromSlot(“Checkpoint”, 0);
how can i get the return value from that so i can cast to the save game
UGameplayStatics::LoadGameFromSlot(“Checkpoint”, 0);
how can i get the return value from that so i can cast to the save game
Returns Object containing loaded game state (nullptr if load fails)
I am trying to get the return value from load game from slot so i can cast to get the vector but i cant figure it out.
I don’t understand. The function already returns the object:
auto savedgame = UGameplayStatics::LoadGameFromSlot("Checkpoint", 0);
Now, you just need to cast the savedgame object.
Sorry to be annoying but is this the right way to cast it because it keeps crashing
if (savedgame)
{
SaveGameM = Cast(savedgame);
if (IsValid(SaveGameM))
{
SetActorLocation(SaveGameM->PlayerLoc);
}
}
Thank you so much, have a good day