using UnityEngine;
using UnityEngine.SceneManagement;

public class SceneReloadHotKey : MonoBehaviour
{
	public KeyCode reloadSceneKey = KeyCode.R;
	public bool reloadEnabled = true;

    void Update()
    {
		if (Input.GetKeyDown(reloadSceneKey))
		{
			RestartCurrentLevel();
		}
	}

	private void RestartCurrentLevel()
	{
		SceneManager.LoadScene(SceneManager.GetActiveScene().name);
	}

	private void Start()
	{
		if (reloadEnabled)
		{
			Debug.LogWarning("The SceneReloadHotKey debug feature is enabled.  It is attached to " + transform.name);
		}
	}
}
