Scriptum/Assets/Scripts/SaveController.cs

22 lines
567 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class SaveController : MonoBehaviour
{
public void SaveScene()
{
string activeScene = SceneManager.GetActiveScene().name;
PlayerPrefs.SetString("SceneSaved", activeScene);
}
public void LoadScene()
{
string sceneToGoTo = PlayerPrefs.GetString("SceneSaved");
SceneManager.LoadScene(sceneToGoTo);
string continued = "yes";
PlayerPrefs.SetString("continued", continued);
}
}