Hello there,
We are trying to code a ‘Continue’ button in our Main Menu that would load the most recently created savegame, but is not always working (sometimes it does, sometimes not). Do you guys have any advice on how to proceed with this? Here’s our code so far:
DirectoryInfo dirInfo = new DirectoryInfo(PlatformPath.GetPersistentPath());//Savegames data
if (dirInfo.Exists) {
FileInfo[] filesInfo = dirInfo.GetFiles ("SaveSlot*.sav");
if (filesInfo.Length == 0) {
DeactiveContinue ();
} else {
int selIndex = 0;
filesInfo[selIndex].Refresh();
for (int i = 0; i < filesInfo.Length; ++i) {
filesInfo*.Refresh ();*
_ if (filesInfo .CreationTime > filesInfo [selIndex].CreationTime)_
* selIndex = i;*
* }*
* continueFileName_ = filesInfo [selIndex].Name;*
* }*
* } else {*
* DeactiveContinue ();*
* }*
Maybe the CreationTime property is not the most appropriate way to check this, but we are not sure.
Thanks in advance