Answer the question
In order to leave comments, you need to log in
Endless repetition?
private void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (bol == false)
{
Pause();
return;
}
if (bol == true)
{
Resume();
}
}
}
public void Resume()
{
for (int i = 0; i < 5; i++)
{
but[i].SetActive(false);
}
Time.timeScale = 1f;
bol = false;
}
void Pause()
{
for (int i = 0; i < 5; i++)
{
but[i].SetActive(true);
}
Time.timeScale = 0f;
bol = true;
}
Answer the question
In order to leave comments, you need to log in
.. I read the comments .. well, now I definitely won’t pass by ..
Endless repetition?there is a fundamental principle for organizing loops, any - provide an exit condition
if (bol == false) {}
if (bol == true) {}
наif (bol) {}
else {}
bol
у вас тут не определеноbol
) напрашивалось бы примерно так:if (Input.GetKeyDown(KeyCode.Escape))
Pause();
else
Resume();
if (!Input.GetKeyDown(KeyCode.Escape))
Pause();
else
Resume();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question