Skip to content

Instantly share code, notes, and snippets.

@delphic
Created April 11, 2019 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save delphic/3e5e14dfa1e07ec1b612b7a4e24ea01f to your computer and use it in GitHub Desktop.
Save delphic/3e5e14dfa1e07ec1b612b7a4e24ea01f to your computer and use it in GitHub Desktop.
Simple Unity Debugging Timescale Helper
using UnityEngine;
public class DebugTimeScaler : MonoBehaviour
{
#if UNITY_EDITOR
void Update()
{
if (Input.GetKeyDown(KeyCode.LeftBracket))
{
Time.timeScale /= 2f;
}
if (Input.GetKeyDown(KeyCode.RightBracket))
{
Time.timeScale *= 2f;
}
if (Input.GetKeyDown(KeyCode.Backspace))
{
Time.timeScale = 0f;
}
if (Input.GetKeyDown(KeyCode.Return))
{
Time.timeScale = 1f;
}
}
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment