I want death screen with life counter

I’m working on my first game and trying to teach myself as I go. I just made a new scene with the words “you died” and my little death tune playing in the background and I was thinking this was going to be pretty easy until I came to the Application.loadlevel part and realized that if I load current level it’s going to keep loading my death scene and if I specify the level to load I will have to make a death scene for each level. Are those really my only two options? The other option that I considered was no death scene at all, just play the death tune and reload the level, but it just plays over top of the level music I already have playing and I know of no way to stop it from playing.

I know people don’t always like giving out the answer so even if you could just guide me where to look for the answer because I can’t even think of where to look and Google isn’t being helpful this time around.

Thanks!

I’m assuming you have a variable for your lives?

Just make it so if lives are all gone you load your death scene.

If you mean just while you are using the editor, just open the build page and drag your death scene to the bottom. This way you can play through all your scenes without having the death screen keep popping up.

using UnityEngine;
using System.Collections;

public class YouDied : MonoBehaviour
{

	void Update()
	{
		if(LivesManager.lives <= 0)
		{
			Application.LoadLevel ("GameOverScreen");
		}
	}
}

Here is a simple script I used in an earlier game to do roughly what you want.

LivesManager refers to another script.

lives was a ‘static’ variable I used to contain the number of lives.

When lives reached zero it loaded my death screen.