- Home /
How come when I restart my level it doesn't work?
if (PlayerHealthScript.playerHealth == 0)
{
Application.LoadLevel(Application.loadedLevel);
}
}
When my player hits 0 health it reloads the level but none of the input works and nothing happens.
Can you be more specific? Can you give a replicatable example?
$$anonymous$$onsters come out from the walls and you need to kill them to get to the next level, if the monsters kill you and get you to 0 health, the level is suppose to just restart completely. But when your health reaches zero, it looks like it restarts the level but the monsters never come out again and I can't move my player
Could be a silly question, but is common at times. Are you loading the correct scene?
Is there anything different from when you load this level initially? Have any DontDestroyObjectOnLoad objects?
Answer by RyanZimmerman87 · Aug 14, 2013 at 12:15 AM
I would check your Time.timescale.
Try putting this into one of your scenes Start() Functions:
void Start()
{
// *******to make game work correctly in Unity Editor
Time.timeScale = 1;
}
I have had issues before where in Unity Editor mode the time got all messed up for no apparent reason so now I just keep this in my PlayerMoveScript Start()
would I need to put this in every script where I use the Time class?
@Crilled Time
is a static class, changing it in one place is the same as changing it somewhere else
Answer by Crilled · Aug 14, 2013 at 12:21 AM
I had all my variables set without a start function, that was the problem. Fixed it thank you all for the help.