public void Save() { // Get all needed to save data data.CollectDataToSave(); // Convert data to json string json = JsonUtility.ToJson(data); // Encrypt data byte[] soup = crypto.Encrypt(json); // Generate filename string filename = Path.Combine(Application.persistentDataPath, SAVE_FILE); // If previous save exists delete it if (File.Exists(filename)) { File.Delete(filename); } // Write new save File.WriteAllBytes(filename, soup); }