Game Development Reference
In-Depth Information
LoadedPlayer.LoadPlayerSaveState(currentPlayer);
}
}
}
catch
{
Debug.LogError("Loading data failed, file is
corrupt");
}
LoadComplete();
}
Again, this is just the reverse of saving the file with one difference: you have to test
whether the save file exists first, else it will result in an error in the worst way possible.
You should note that we do not return the saved data directly back to the calling function;
instead, we use a delegate to tell the caller when it is finished. The reason for this is
simple: accessing the disk is slow. So, we need to ensure we have finished loading all of
our data before we continue with our game, which is obviously very important. You can,
if you want, also do this with the Save function if you wish as well.
Search WWH ::




Custom Search