Search Unity

Saving and Loading data Help

Discussion in 'Editor & General Support' started by Wrexer, Oct 22, 2016.

  1. Wrexer

    Wrexer

    Joined:
    Oct 22, 2016
    Posts:
    2
    Hey,
    I am creating a survival game in unity with c# and i am needing a fast solution for saving and loading player data, world data and other types of data from many scripts, i am also using Photo to make the game multiplayer, if anyone could help me find out a great method of saving data it would be much appreciated. :)
     
    Last edited: Oct 22, 2016
  2. mikael_juhala

    mikael_juhala

    Joined:
    Mar 9, 2015
    Posts:
    247
    I'm storing my data in a JSON file. And when the game is loaded, I deserialize the file directly into C# classes (such as PlayerData).

    If you want to try that, here's a tutorial (you can find many more by googling "jsonfx" or "unity json"):
    http://www.raybarrera.com/2014/05/18/json-deserialization-using-unity-and-jsonfx/

    EDIT: Not sure if it fits your needs, but you can also try using PlayerPrefs:
    https://docs.unity3d.com/ScriptReference/PlayerPrefs.html

    EDIT: Here's one tutorial from Unity:
    https://unity3d.com/learn/tutorials/topics/scripting/persistence-saving-and-loading-data
     
  3. Wrexer

    Wrexer

    Joined:
    Oct 22, 2016
    Posts:
    2
    Thanks for you help, i am not wanting to use player prefs are they are unsecured, i was thinking i am going to use a json file.