Is there a work around for no ES3.GetFiles on WebGL builds?

Discussion and help for Easy Save 3
Post Reply
fartasanelk
Posts: 1
Joined: Tue Jan 26, 2021 12:41 am

Is there a work around for no ES3.GetFiles on WebGL builds?

Post by fartasanelk »

I am trying to populate a drop down on my Map Editor to load. I am saving each one to a separate json file.

Code: Select all

private void GetFilenamesToLoad()
{
    loadDropDown.options.Clear();
    foreach (var filename in ES3.GetFiles(Application.persistentDataPath + "/UserMaps/"))
    {
        loadDropDown.options.Add(new TMP_Dropdown.OptionData(filename));
    }
    loadDropDown.RefreshShownValue();
}
However in WebGL I cannot use ES3.GetFiles.

Only thing I can think of is using a single file for all user created maps.

Any Ideas
User avatar
Joel
Moodkie Staff
Posts: 4848
Joined: Wed Nov 07, 2012 10:32 pm

Re: Is there a work around for no ES3.GetFiles on WebGL builds?

Post by Joel »

Hi there,

The simplest way to work around this is to save your filenames to a separate file whenever you save to a file. For example:

Code: Select all

ES3.Save(filename, "", "filenames.es3");
Then you can get a list of filenames using:

Code: Select all

string[] filenames = ES3.GetKeys("filenames.es3");
All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply