What is the best way to load all save files inside a folder?

Discussion and help for Easy Save 3
Post Reply
88888888
Posts: 25
Joined: Tue Sep 10, 2019 10:41 pm

What is the best way to load all save files inside a folder?

Post by 88888888 »

Hi there. I need to know what is the best way to load all save files inside a folder? Is there any better way than creating a list of all saved .es3 files?
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: What is the best way to load all save files inside a folder?

Post by Joel »

Hi there,

To do this you can use ES3.GetFiles to get an array of filenames, and then iterate through these. It wouldn't be possible to do it without a loop like this because it would be impossible for Easy Save to know what you wanted to load from each file and how.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
88888888
Posts: 25
Joined: Tue Sep 10, 2019 10:41 pm

Re: What is the best way to load all save files inside a folder?

Post by 88888888 »

Thank you. I didn't know about that :geek: but it takes .meta files too and makes array too big as those files are inside StreamingAssets folder.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: What is the best way to load all save files inside a folder?

Post by Joel »

Hi there,

You would need to check the extension before loading from it. I.e.

Code: Select all

foreach(var filename in files)
{
    if(filename.Contains(".meta"))
        continue;
}
Note that the .meta files won't exist in your build.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply