Hello! I'm frequently having an issue with saving the naninovel game state.
In my iOS app, I saved the state every second and continue saving another one if the previous save is successful. It works fine when saving 10-20 times, hard quit the app, and resuming the app to the right nanonovel position. BUT after playing the resumed game for first 10 times success saving, no matter I am using binary or json format for the save state, my code keeps stuck in lines:
Code: Select all
await IOUtils.WriteFileAsync(filePath, bytes);
for binary
or
Code: Select all
await IOUtils.WriteTextFileAsync(filePath, jsonData);
for json
It basically await at those lines forever.
I am in development build, it cannot reproduce on Unity Editor, but only on iOS device. Xcode does not throw any exception about this I/O corruption.
I check with iOS posts, seems they have open files limitation up to 200 files. But the Naninovel code seems always close the files?
Code: Select all
public static async UniTask WriteFileAsync (string filePath, byte[] fileData)
{
if (Application.platform == RuntimePlatform.WebGLPlayer) File.WriteAllBytes(filePath, fileData);
else
{
using (var fileStream = File.OpenWrite(filePath))
await fileStream.WriteAsync(fileData, 0, fileData.Length);
}
WebGLSyncFs();
}
Any ideas for this I/O issues?