- Home /
Question by
kapuscianyglab · Jun 25, 2015 at 07:52 PM ·
issueresume
Problem with resume game.
I have a problem with my game. First run, play, and everything is fine. When there is an inscription "game over", press the button "back to main menu" and "play", the level is working, but do not run scripts.
My button looks like:
My code TimeManager looks like:
public class TimeManager : MonoBehaviour {
public GameObject player;
public GameObject gameoverText;
public GameObject resumeButton;
public Text timeText;
public int timePerLevel = 30;
private float clockSpeed = 1f;
void Awake ()
{
InvokeRepeating("Clock", 0, clockSpeed);
}
void Clock()
{
timePerLevel--;
timeText.text = ("Time: " + timePerLevel);
if (timePerLevel == 0)
{
//Destroy(player);
Time.timeScale = 0;
gameoverText.SetActive(true);
resumeButton.SetActive(true);
}
}
}
My menuevents file looks like:
public class MenuEvents : MonoBehaviour {
public void LoadLevel(int levelIndex)
{
Application.LoadLevel(levelIndex);
}
public void LoadLevel(string levelName)
{
Application.LoadLevel(levelName);
}
public void ExitApplication()
{
Application.Quit();
}
}
beztytułu.png
(17.8 kB)
Comment
Best Answer
Answer by neweichgames · Jun 25, 2015 at 08:25 PM
You have to set the time.timescale back to 1 when you go back to the main menu
Your answer
Follow this Question
Related Questions
Hierarchy object arrow issue 0 Answers
Unity Character's Wont stop moving! 1 Answer
Issue while migrating project from 3.5 to 4.0 1 Answer
Why is a Unity Demo not working on Macintosh? 1 Answer
Allocation Already Register 1 Answer