Hi!
I found after each time I enter play mode, the first time the ES3.Save is called is going to make the game frezze for a little bit of time, the later calls will not. I am calling the same method that will create a new directory and a new file (new folder and a new text file for a new save slot).
I tried calling ES3.Init() in Start(), but it didn't help;
Please help! Thanks!
Lag when first time calling ES3.Save after play
-
- Posts: 5
- Joined: Mon Aug 14, 2023 2:30 pm
Re: Lag when first time calling ES3.Save after play
Hi there,
We've had no reports of this. Please can you show me the code you are using, and also let me know if you've changed any settings.
Could you also use Unity's profiler to see exactly what code is causing the slowdown (I recommend using the Deep Profile option which will give you more information).
All the best,
Joel
We've had no reports of this. Please can you show me the code you are using, and also let me know if you've changed any settings.
Could you also use Unity's profiler to see exactly what code is causing the slowdown (I recommend using the Deep Profile option which will give you more information).
All the best,
Joel
-
- Posts: 5
- Joined: Mon Aug 14, 2023 2:30 pm
Re: Lag when first time calling ES3.Save after play
Please check the attachments for the screenshots of profiler(with Deep Profile ON) and ES3 setting.
The code block executed is
where class WorldSettingProfile is ScriptableObject.
It seems that ES3GlobalReferences.get_GlobalReferences() causes the problem
The code block executed is
Code: Select all
public void SaveNewWorld(string worldName, string worldIdentifier, WorldSettingProfile worldSettingProfile)
{
this.Log($"Start saving new world {worldName} with identifier {worldIdentifier}");
CurrentWorldName = worldName;
CurrentWorldIdentifier = worldIdentifier;
var saveFilePath = GetWorldSaveFilePath(worldName, worldIdentifier);
SaveApplicationVersion(saveFilePath);
SaveWorldSetting(saveFilePath, worldSettingProfile);
this.Log($"End saving new world {worldName} with identifier {worldIdentifier}");
}
Code: Select all
private void SaveApplicationVersion(string saveFilePath)
{
try
{
ES3.Save(nameof(Application.version), Application.version, saveFilePath);
}
catch (Exception e)
{
ShowNotification(LocalizedHints.SaveErrorHint, e.Message);
}
}
Code: Select all
private void SaveWorldSetting(string saveFilePath, WorldSettingProfile worldSettingProfile)
{
try
{
ES3.Save(typeof(WorldSettingProfile).ToString(),
worldSettingProfile, saveFilePath,
new ES3Settings(ES3.ReferenceMode.ByValue));
}
catch (Exception e)
{
ShowNotification(LocalizedHints.SaveErrorHint, e.Message);
}
}
It seems that ES3GlobalReferences.get_GlobalReferences() causes the problem
- Attachments
-
- ES3 SETTING.png (80.47 KiB) Viewed 907 times
-
- ES3 SAVE LAG Hierarchy.png (506.98 KiB) Viewed 907 times
-
- ES3 SAVE LAG Timeline.png (571.61 KiB) Viewed 907 times
Re: Lag when first time calling ES3.Save after play
Thanks for sending that over.
Please could you expand the writer.WriteRef() row below the one you have highlighted, and any other rows beneath it until the percentage is minimal or there are no rows left to expand. This will allow me to see precisely what line is causing the slow down.
Also just to check, are you using the latest version of Easy Save?
All the best,
Joel
Please could you expand the writer.WriteRef() row below the one you have highlighted, and any other rows beneath it until the percentage is minimal or there are no rows left to expand. This will allow me to see precisely what line is causing the slow down.
Also just to check, are you using the latest version of Easy Save?
All the best,
Joel