ThrowBall/Assets/Scripts/SceneLoader.cs

23 lines
537 B
C#
Raw Normal View History

2024-12-01 20:53:59 +08:00
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);
}
}
}