I found an issue, where compression doesnt work with cache.
I made the following example:
Code: Select all
var testObject = new GameObject("testObject");
// Normal
ES3Settings settingsCache = new ES3Settings() { location = ES3.Location.Cache };
ES3.DeleteFile(settingsCache);
ES3.Save("object", testObject, settingsCache);
var data = ES3.LoadRawBytes(settingsCache);
File.WriteAllBytes(Path.Combine(Application.dataPath, "normal.json"), data);
// Compressed file
ES3Settings settingsCompFile = new ES3Settings() { compressionType = ES3.CompressionType.Gzip, location = ES3.Location.File };
ES3.DeleteFile(settingsCompFile);
ES3.Save("object", testObject, settingsCompFile);
data = ES3.LoadRawBytes(settingsCompFile);
File.WriteAllBytes(Path.Combine(Application.dataPath, "compressed_file.json"), data);
// Compressed file fixed
ES3.DeleteFile(settingsCompFile);
ES3.Save("object", testObject, settingsCompFile);
data = ES3.LoadRawBytes(new ES3Settings(ES3.Location.File));
File.WriteAllBytes(Path.Combine(Application.dataPath, "compressed_file_fixed.json"), data);
// Compressed cache
ES3Settings settingsCompCache = new ES3Settings() { compressionType = ES3.CompressionType.Gzip, location = ES3.Location.Cache };
ES3.DeleteFile(settingsCompCache);
ES3.Save("object", testObject, settingsCompCache);
data = ES3.LoadRawBytes(new ES3Settings(ES3.Location.Cache));
File.WriteAllBytes(Path.Combine(Application.dataPath, "compressed_cache.json"), data);
First issue even with File location is that LoadRawBytes cannot have compression in its settings. If it has the compression wont work.
Second issue, when using compression and cache location together, compression wont work.
Only case when compression worked was when Save had (location=File, compression=Gzip) and LoadRawBytes had (location=File)