public void Execute(int slotNumber) { saveSlot.Value = slotNumber; SaveGame getSaveGame = SaveUtility.LoadSave(slotNumber); SceneManager.LoadScene(getSaveGame.lastScene); SceneManager.LoadScene(playerScene.Value, LoadSceneMode.Additive); }
public override void OnLoadSystem() { cachedSaveData = SaveUtility.LoadSave(saveSlot.Value); if (cachedSaveData == null) { CreateNewSave(); isNewGame = true; } onSceneWarp?.AddListener(OnSceneWarp); onWarpStart?.AddListener(OnWarpStart); onWarpEnd?.AddListener(OnWarpEnd); }
public override void OnLoadSystem() { Debug.Log("SaveSystem.OnLoadSystem"); cachedSaveData = SaveUtility.LoadSave(saveSlot.Value); Debug.Log(cachedSaveData); if (cachedSaveData == null) { CreateNewSave(); isNewGame = true; } onChangeScene?.AddListener(OnChangeScene); onTeleportStart?.AddListener(OnTeleportStart); onTeleportEnd?.AddListener(OnTeleportEnd); }
public void OnLoad(string data) { if (string.IsNullOrEmpty(data)) { return; } currentSaveGame = SaveUtility.LoadSave(currentSaveSlot.Value); if (currentSaveGame == null) { Debug.Log("Could not find current save"); return; } SaveData saveData = JsonUtility.FromJson <SaveData>(data); if (saveData.data != null && saveData.data.Count > 0) { for (int i = 0; i < saveData.data.Count; i++) { SaveablePrefab saveablePrefab = ScriptableAssetDatabase.GetAsset(saveData.data[i].prefabGUID) as SaveablePrefab; if (saveablePrefab == null) { Debug.Log($"Could not find reference in ScriptableAssetDatabase for Saveable Prefab : {saveData.data[i].prefabGUID}"); continue; } for (int i2 = 0; i2 < saveData.data[i].saveableGUIDs.Count; i2++) { Saveable getSaveable = saveablePrefab.Retrieve <Saveable>(saveData.data[i].saveableGUIDs[i2]); getSaveable.OnLoadRequest(currentSaveGame); #if UNITY_EDITOR getSaveable.transform.SetParent(this.transform, true); #endif } } } }