Skip to content

Instantly share code, notes, and snippets.

@beardordie
Created March 24, 2020 03:43
Show Gist options
  • Save beardordie/b9bb22e4c2dce03c41ed9aa949cdaf2c to your computer and use it in GitHub Desktop.
Save beardordie/b9bb22e4c2dce03c41ed9aa949cdaf2c to your computer and use it in GitHub Desktop.
Unity - Press F5 to reload the current Scene. Used a lot in development. Probably remove before making a public build.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class F5ReloadScene : MonoBehaviour {
public KeyCode keyCode = KeyCode.F5;
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(keyCode))
{
UnityEngine.SceneManagement.SceneManager.LoadScene(UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment