Hello, I’ve followed all the tutorials but my save game is always loading empty.
**USaveGameFile **is a class derived from **USaveGame **with a float Test variable on it.
I save the game and it prints a random number to be saved (UT::Pop is just my print function), but whenever I load the game it’s always 0.
void USD::SaveGame() {
USaveGameFile* save = Cast<USaveGameFile>(UGameplayStatics::CreateSaveGameObject(USaveGameFile::StaticClass()));
save->Test = FMath::FRandRange(0, 10000);
UT::Pop("Saving:", save->Test); // Prints Saving: 7346 (random number)
UGameplayStatics::SaveGameToSlot(save, TEXT("SaveGame"), 0);
}
void USD::LoadGame() {
USaveGameFile* save = Cast<USaveGameFile>(UGameplayStatics::LoadGameFromSlot(TEXT("SaveGame"), 0));
UT::Pop("Loading:", save->Test); // Prints Loading: 0
}
Thoughts?
Thanks!