using UnityEngine; using UnityEngine.SceneManagement; public class SceneLoader : MonoBehaviour { public KeyCode switchSceneKey = KeyCode.Space; public int loadSceneBuildIndex = 1; public KeyCode reloadSceneKey = KeyCode.R; void Update() { if (Input.GetKeyDown(switchSceneKey)) { SceneManager.LoadScene(loadSceneBuildIndex); } if (Input.GetKeyDown(reloadSceneKey)) { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } } }