Exemplo n.º 1
0
    public static void Save(PortesArmari portesArmari)
    {
        string           jsonPath = Application.persistentDataPath + "/portesArmari.json";
        PortesArmariData data     = new PortesArmariData(portesArmari);
        string           json     = JsonUtility.ToJson(data);

        File.WriteAllText(jsonPath, json);
        Debug.Log("Save " + json);
    }
Exemplo n.º 2
0
    private void OnEnable()
    {
        PortesArmariData portesArmari = SavePortesArmariJson.Load();

        index = portesArmari.index;

        if (index == 1)
        {
            timeline.PlayFromTimelines(index);
        }
    }
Exemplo n.º 3
0
    public static PortesArmariData Load()
    {
        string jsonPath = Application.persistentDataPath + "/portesArmari.json";

        if (File.Exists(jsonPath))
        {
            string           jsonRead = File.ReadAllText(jsonPath);
            PortesArmariData data     = JsonUtility.FromJson <PortesArmariData>(jsonRead);
            Debug.Log("Load " + jsonRead);
            return(data);
        }
        else
        {
            Debug.LogError("Save file not found in" + jsonPath);
            return(null);
        }
    }