I have watched a tutorial and LitJSON looks easy to use and it looks good, but I am not a big fan of third party tools.
And I also can’t seem to find ANY tutorials on the .NET built in JSON system.
Did you already see Unity - Manual: JSON Serialization ?
1 Like
Thank you very much.
Now I have a few newbie questions:
- Do I have to place the [Serializable] thingy above the class name? If yes, why?
- Say I have an object, character, and I added one character, then as the player progresses more characters are added into the game, how can I add new ones into the Json file without overwriting the current characters?
Yes. This signals to Unity that you want it to generate a serialisation command stream for the type, which is needed to convert it to/from JSON (as well as for some other things).
You always write all the characters into the file - both the old characters and the new ones.
How? Write all text overwrites the current text, which is JSON in the file and replaces it with the new one. (As far as I know)