Question by
BlobIsABlob · Dec 01, 2021 at 07:33 AM ·
how
Why isn't my slow motion script working?
Hey, thanks for coming here.
I recently created this slow motion script for my game. So when the player presses the Q button, the slow motion starts, and when you let go of Q the slow motion stops. Here is the code:
using UnityEngine;
public class TimeControl : MonoBehaviour { float startingScale = 1f; float updatedScale = 0.5f;
void Update()
{
if (Input.GetKeyDown(KeyCode.Q))
{
Time.timeScale = updatedScale;
}
else if (Input.GetKeyUp(KeyCode.Q))
{
Time.timeScale = startingScale;
}
}
}
This code does not show any error messages. Any fixes for this will be appreciated :D
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613050047im_/https://answers.unity.com/themes/thub/images/avi.jpg)