Dealing with save files?
I'm trying to make a save that works beetwen sessions, but when I close and then open my game again, it doesnt load the old save data (using Flxsave).
To maintain data between sessions, do you guys write to a file using Sys.io.File or use Flxsave? Maybe I'm doing something wrong.
I think i fixed it using Flxsave. It's a serialization on an object class that was causing the issue. I'll post a solution tomorrow, so people that have the same problem can use it.
Maybe forgot to call .flush() on FlxSave
Thank you for replying. I figured out the problem, it was a two part:
- Correctly check if there's data already on the Flxsave slot (that was pretty dumb on my part, i skipped that).
- You can't push a class into the save file like this:
That gave me a trace overflow issue in flashdevelop, so i figured:
_save.data.MyVar.push( Type.getClassName(Type.getClass(MyClass)) );
Works fine because it stores it as a string. When loading you can get you class by doing Type.resolveClass().
That resolves the issue, hopefully it helps someone in the future. It wasnt clearly documented in the haxeflixel docs.
Thanks again for replying.