//Write a string to the per-user storage public static void WriteTextUserData(string filename, string text) { #if UNITY_XBOXONE && !UNITY_EDITOR XboxOneConnectedStorage.SaveData(filename, Encoding.ASCII.GetBytes(text)); #elif UNITY_PS4 PS4Manager.WriteData(filename, Encoding.ASCII.GetBytes(text)); #else File.WriteAllText(Path.Combine(persistentDataPath, filename), text); #endif }
//Write a chunk of data to the per-user storage public static void WriteBinaryUserData(string filename, byte[] data) { #if UNITY_XBOXONE && !UNITY_EDITOR XboxOneConnectedStorage.SaveData(filename, data); #elif UNITY_PS4 PS4Manager.WriteData(filename, data); #else File.WriteAllBytes(Path.Combine(persistentDataPath, filename), data); #endif }