Application.loadLevel not working?

Hi, I have a basic game over Application.LoadLevel script, and it works perfectly: But only on the unity editor. When I build and run the game, the actual level loading is slow (which I don’t mind), but when the game is over and I load the game over scene, nothing happens.

I’ve checked and re-checked the build settings, the script, and the camera depth. Nothing.

What’s going on?

Can no one help? :frowning:

Have you set Time.timescale to 0 in any scene?

+1 for timescale

My pausemenu script had same problem if Main menu was pressed. Mainmenu was loaded, but nothing worked (timescale was still zero)

code was like:

if (mainmenu pressed)
timescale =1;
loadlevel(mainmenu)

Problem was, timescale newer executed. I believe timeScale is executed end of the frame, and loadLevel immediately.

Yeah i had the same problem too! All i did was add Time.timescale = 1 in my MainMenu script.

Thanks for your time, folks, but it still doesn’t work. :frowning:

When the game ends (As in, when the character dies), everything else get’s deleted and just the character remains.

Are you deleting the GameObject that contains the script doing the LoadLevel call?

Yes, but only after the level has loaded and you click replay.

You sure about that? :slight_smile:

Yep, the player’s only deleted when the replay button is clicked. That’s because it otherwise won’t be able to display the score, and it’s deleted to make room for a new score and character.