I’m making a simple pause script by setting timescale to 0 when pressing the start button on an xbox controller. This works just fine…until you try to press the button again to unpause the game and then it doesn’t respond till about the tenth time you press it. I changed the input to detect a keyboard input and the same piece of code didn’t have that problem so does anyone know exactly what effect timescale has on gamepad inputs. I have heard that it messes up the asix for the thumbsticks but I thought the buttons still worked fine. This is just the simple toggle I’m using. I read somewhere else that it works better to run the pause function in a coroutine but I tried that and it still didn’t work so if anyone has any suggestions it would be much appreciated.
bool Paused = false;
void Update()
{
//start is set for my controller
If(Input.GetKeyDown(KeyCode.P)) || Input.GetButtonDown("Start"))
{
if(Paused == true)//once paused start no longer works
{
Time.TimeScale = 1f;
Paused = false;
}
else//start works to pause this
{
Time.TimeScale = 0f;
Paused = true;
}
}
}