C# Serialization error on Mobile using FileStream

Hey Guys,

So I have a SaveGame file that I want to use to Save/Load my game. When I use it in the Editor it works like a charm, but when I tested it on device, it crashed on the FileStream. Looks like I can’t use it on Android at least. Somebody suggested a TextAsset instead of the filestream and save it as a .bytes extension. The problem with this is that I can only read a TextAsset, and cannot modify it (correct me if I’m wrong though). Unfortunatly, I have to write my savegame also. Does somebody have a simple solution to be able to save/load serialized data without a FileStream ?

Thanks a lot for your time and have a great day !

Claude

Never had any problems using file streams on iOS/Android.

  1. We always use BinaryWriter, but it implements some sort of stream internally so shouldn’t be a problem there.
  2. Most likely this is a file system access restriction. Apps on mobile are executed from the installation folder to which the app doesn’t have write permissions, try saving to Application.persistentDataPath, it is a unity property which should always resolve to a correct write able path according to platform.

Sorry for the brief response, on vacation posting from mobile :slight_smile: