ReloadSceneOnKeyDown.cs 361 B

123456789101112131415
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5. public class ReloadSceneOnKeyDown : MonoBehaviour {
  6. public KeyCode reloadKey = KeyCode.R;
  7. void Update () {
  8. if (Input.GetKeyDown(reloadKey))
  9. SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex, LoadSceneMode.Single);
  10. }
  11. }