- Home /
Timescale wont work
Everything was working perfectly until yesterday. I dont know what happened but all of my timescales stopped working (I cant set the timescale to 0 if i want to pause my game)and i cant make it work with my pause script. Anyone know the problem? Im using ui for the pause script.Heres my pause script.
public bool paused = false;
public GameObject pause; // Assign in inspector
private bool isShowing;
bool restart;
bool shop;
bool menu;
void Start ()
{
pause.SetActive(false);
paused = false;
Time.timeScale = 1;
}
public void Pause (bool paused)
{
pause.SetActive (true);
Time.timeScale = 0;
}
public void UnPause (bool paused)
{
Time.timeScale = 1;
pause.SetActive (false);
}
public void Restart (bool restart)
{
Application.LoadLevel ("main");
}
public void ShopLevel (bool shop)
{
Application.LoadLevel ("shop");
}
public void Menu (bool menu)
{
Application.LoadLevel ("-main menu");
}
What do you mean by not working? Try printing the timescale to the console. Do you have any error lurking around? Do you have a level called "-main menu" ?
By not working I mean the timescale won't set to 0 when I pause my game and yes I have a level called "-main menu"
Are you sure that it's not setting to zero? Or are you assu$$anonymous$$g that because something else isn't behaving as you expect? How can you tell that it's not setting to zero?