Answer the question
In order to leave comments, you need to log in
Why does the button work from 2 times?
private void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
PauseResumeToggle();
}
}
public void PauseResumeToggle()
{
if (bol)
{
Resume();
}
else
{
Pause();
}
}
void Resume()
{
for (int i = 0; i < 5; i++)
{
but[i].SetActive(false);
}
Time.timeScale = 1f;
bol = false;
Cursor.lockState = CursorLockMode.Locked;
}
void Pause()
{
for (int i = 0; i < 5; i++)
{
but[i].SetActive(true);
}
Time.timeScale = 0f;
bol = true;
Cursor.lockState = CursorLockMode.None;
}
Answer the question
In order to leave comments, you need to log in
In place of the lines "bol = false;" "bol = true;" should be "bol = !bol;"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question