added customization
This commit is contained in:
1 parent
1d7d176814
commit
51b5659f4a
116 files changed
+16093
-5
No files matched your search
@@ -0,0 +1,23 @@
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Saves
|
||||
{
|
||||
public static class SaveManager
|
||||
{
|
||||
private static string Path => Application.persistentDataPath + "/save.json";
|
||||
|
||||
public static void Save(GameData data)
|
||||
{
|
||||
var json = JsonUtility.ToJson(data, true);
|
||||
File.WriteAllText(Path, json);
|
||||
}
|
||||
|
||||
public static GameData Load()
|
||||
{
|
||||
if (!File.Exists(Path)) return new GameData();
|
||||
var json = File.ReadAllText(Path);
|
||||
return JsonUtility.FromJson<GameData>(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user