I have been using Easy Save to great effect since I purchased it, thank you so much for this great asset.
I have a script that works well in the editor but does not work in my mobile build and, after a few days of troubleshooting and researching, I would like to ask for some assistance to fix it and to better understand how to use Easy Save.
This code is supposed to sync the user's saved volume setting onenable, onfocus(true), and onpause(false). I've tried different combinations of these calls but I can't get it to work correctly on build, though it works in the editor. It is also intended to change the value of the UI Toolkit slider to math the saved volume float, which works fine in the editor between plays (I understand this is not the same as closing an application):
Code: Select all
void SyncVolume ()
{
if (ES3.KeyExists("Music"))
{
sl_music.value = ES3.Load<float>("Music");
SoundVolumeChange(sl_music.value, "Music");
}
if (ES3.KeyExists("SFX"))
{
sl_sfx.value = ES3.Load<float>("SFX");
SoundVolumeChange(sl_sfx.value, "SFX");
}
}
void SoundVolumeChange (float volume, string type)
{
audioMixer.SetFloat(type, MathF.Log10( volume)*20);
ES3.Save<float>(type, volume);
}