Created
April 11, 2019 11:02
-
-
Save delphic/3e5e14dfa1e07ec1b612b7a4e24ea01f to your computer and use it in GitHub Desktop.
Simple Unity Debugging Timescale Helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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