private void SaveDebugData() { GameDataList dataList = new GameDataList(); dataList.SaveFileNames.AddRange(new List <string> { "Save 1", "Save 2", "Save 3" }); PlayerPrefs.SetString(SaveFileKey, JsonUtility.ToJson(dataList)); }
private void LoadFileList() { if (!PlayerPrefs.HasKey(SaveFileKey)) { return; } string jsonString = PlayerPrefs.GetString(SaveFileKey); GameData = JsonUtility.FromJson <GameDataList>(jsonString); if (GameData.SaveFileNames.Count <= 0) { return; } foreach (string saveName in GameData.SaveFileNames) { //RectTransform widget = Instantiate(SaveSlotPrefab).GetComponent<RectTransform>(); SaveSlotWidget widget = Instantiate(SaveSlotPrefab, LoadItemPanel).GetComponent <SaveSlotWidget>(); widget.Initialize(this, saveName); } }