Hi guys, I’m terribly lost with this topic, I want to save an array (or data group like struct or class) with data in binary to “protect” the data.
This was really easy to do in obj-c
NSArray *recordsarray=[NSArray arrayWithObjects:setscores,
setscores2, setscores3,nil];
NSString *errString;
NSData *serializedSettings=[NSPropertyListSerialization dataFromPropertyList:recordsarray format:NSPropertyListBinaryFormat_v1_0 errorDescription:&errString];
[serializedSettings writeToFile:@"myfile.data" atomically:NO];
[errString release];
And I had my array saved on disk, ready to read it later when I need it, but now with all this javascript and C# crap I don’t know how to do it, I’m only finding examples (C#) to save text files, or some binary data really limited with binaryformatter (ints, float,etc,etc) but not arrays or data groups.
So what can I do?, how people save the data for their games?
If you’re really happy doing it with Objective C, why not continue to do it with Objective C? I haven’t really got stuck into Unity iPhone (yet) - and I’m personally very happy with text/xml files - but it seems you can write “plugins” with Objective C. So surely you could wrap up a little plugin to save your binary data and call it from Unity?
@Eskema, I’m with you with missing the good old binary property lists and NSCoding in Objective-C. I whipped up something a while back that might suit your needs: Object Persister.
If you just add either Base64 encoding (if you just want obfuscation) or encryption to that it might work for you but no guarantees.
The problem with the plain txt/xml files, is the access, I don’t want people messing around the scores.txt/xml to modify their scores or any other value that I would save.
I’m waiting for the final release of u3 to start writing some plugins to make my work easier.
uprise78 I will take a look at your class to see how the object is stored on disk 