I was following this tutorial Using a Unity button to switch between scenes. and when I try to make this script in another scene it doesn’t work. I am using this as a reset button for my game to restart the level because I couldn’t figure out how to make a key like r do it instead. Is there a way I can use r instead of this method?
This is for the button method.
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneSwitcher : MonoBehaviour
{
private const string SceneName = "LevelOne";
public void GotoMainScene()
{
SceneManager.LoadScene("LevelOne");
}
public void GotoMenuScene()
{
SceneManager.LoadScene(SceneName);
}
}