Hi, it’s the first time I’m trying to save data in a game, so I don’t really know what are normal performance. I am using Easy Save 3 asset.
When I save variables my game freeze for about 4-5 seconds. I have a loop that save around 160 variable int to a file, I thought that wasn’t a lot but it’s a lot? When bigger have thousands of stats and data everywhere I didn’t expect to save 160 int so a file would be a problem and make my game lag for multiple seconds. The problem is that my game is for android, so even if I put the save on exit or on pause, if the person exist the app completely (swiping up from app tray to remove from cache), my game doesn’t have time to save. My load takes also a bit of time on android.
public void SaveCubes()
{
foreach (Cube cube in parent8.GetComponentsInChildren<Cube>()) //around 160 loops
{
ES3.Save<int>("cube" + cube.id, cube.id);
}
}
foreach (Cube cube in cubeList.cubeToSpawnList)
{
if(ES3.KeyExists("cube" + cube.id))
{
//checks things comparing stuff with the id
}
}