I’m trying to save player’s data on WebGL platform but File.WriteAllBytes and File.WriteAllText works only in Awake any further calls just doesn’t work and there’s no exceptions in console. Everything works perfectly on other platforms (Editor, desktop mono, desktop il2cpp, android mono, android il2cpp, etc). I’m missing something?
Unity version: 2022.1.7f1
// Test code
public class Tester : MonoBehaviour
{
private void Awake()
{
// Works
File.WriteAllText(Path.Combine(Application.persistentDataPath, "save_0.dat"), "some data");
}
private void Update()
{
// Doesn't work
if (Input.GetKeyDown(KeyCode.Space))
File.WriteAllText(Path.Combine(Application.persistentDataPath, "save_1.dat"), "some data");
}
}