SaveFile.es3 just getting larger and larger
Posted: Wed Jun 24, 2020 12:03 pm
I have issues with because its getting larger every time data is overwritten,
data that is actually being changed is fine and its at the top of the file all the time:
But data that is not being changed gets more
empty space between it and closing bracket (})
it will have empty space like this, and will increase it over time:
Im saving layer positions, and looking for the time that camera stops moving (in LateUpdate())
Can i resolve this by removing empty space somehow?
data that is actually being changed is fine and its at the top of the file all the time:
Code: Select all
"ScenePositions" : {
"__type" : "UnityEngine.Vector3[],UnityEngine.CoreModule",
"value" : [
{
"x" : 114.635986,
"y" : -0.69,
"z" : 0
},{
"x" : 132.156,
"y" : -0.69,
"z" : 0
},{
ETC....
empty space between it and closing bracket (})
it will have empty space like this, and will increase it over time:
Code: Select all
"PoppyHouse_isHouseOpen" : {
"__type" : "System.Boolean",
"value" : true
--> empty space
}
Code: Select all
if (hasCameraMoved)
{
hasCameraMoved = false;
ES3.Save<Vector3>("CameraSavedPosition", Camera.main.transform.position);
#if UNITY_EDITOR
Debug.Log("[EDITOR] Saving camera and paralax layers positions");
#endif
for (int i = 0; i < skyParts.Length; i++)
{
savedSkyPositions[i] = skyParts[i].localPosition;
}
ES3.Save<Vector3[]>("SkyLayersPositions", savedSkyPositions);
ES3.Save<List<int>>("SkyLayerOrder", skyLayerOrder);
for (int i = 0; i < middlegroundParts.Length; i++)
{
savedMiddlegroundPositions[i] = middlegroundParts[i].localPosition;
}
ES3.Save<Vector3[]>("MiddlegroundPositions", savedMiddlegroundPositions);
ES3.Save<List<int>>("MiddlegroundLayerOrder", middlegroundLayerOrder);
for (int i = 0; i < sceneParts.Count; i++)
{
savedScenePositions[i] = sceneParts[i].localPosition;
}
ES3.Save<Vector3[]>("ScenePositions", savedScenePositions);
ES3.Save<List<int>>("SceneLayerOrder", sceneLayerOrder);
}
return;
}