Saving game

UGameplayStatics::LoadGameFromSlot(“Checkpoint”, 0);

how can i get the return value from that so i can cast to the save game

From https://docs.unrealengine.com/en-US/API/Runtime/Engine/Kismet/UGameplayStatics/LoadGameFromSlot/index.html:

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.

310820-screenshot-2020-08-20-at-115552.png

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.

310836-screenshot-2020-08-20-at-132500.png

Sorry to be annoying but is this the right way to cast it because it keeps crashing

310838-screenshot-2020-08-20-at-132333.png

if (savedgame)
{
SaveGameM = Cast(savedgame);
if (IsValid(SaveGameM))
{
SetActorLocation(SaveGameM->PlayerLoc);
}
}

Thank you so much, have a good day