When you die in one of these 2 games I took screenshots of (Temple Run and Subway Surfers), what exactly comes up to say "Game Over" and posts your score and all-time high score?

Is it a different scene that is loaded after you die and says "Game Over" and has all of your stats?

Is it some sort of UI element that is enabled and becomes visible after the player dies and then it says "Game Over" and shows your stats (Just like the Game Over lesson on the Unity Survival Shooter tutorial)?

Or is something else entirely that I have no idea of? I'd like to implement a similar feature.

Temple Run gameover Subway Surfers gameover


2 Answers 2


If I would implement it in Unity I'd do a dedicated scene with a GUI to show whatever is needed.

So in the main scene I would have some script not destroyed on load of a new scene (with DontDestryOnLoad(GameObject go) method) which have all the infos you want to display at the Game Over stage.

You could also handle it in a whole scene with variables to control the game state and when it becomes GameOver then the GUI displays it properly.

  • \$\begingroup\$ Is there a class or function called "NotDestoryOnSceneSwap", because I did some research on google and I could not find that lol. Maybe it is "DontDestoryOnLoad" that you were talking about? @Leggy7 \$\endgroup\$ Commented Jun 23, 2016 at 14:34
  • \$\begingroup\$ sure thing, that one \$\endgroup\$
    – Leggy7
    Commented Jun 23, 2016 at 14:54

While I don't know for sure what these two games do, this is how I would do it:

  1. Have a Canvas set up with a child GameObject (which can be a prefab) holding all Game Over UI elements. This starts as disabled
  2. In the UI GameObject have a script which listens to OnEnable and fills out the relevant info (stats etc)
  3. Have a Game Controller that controls the state of your game (Paused, Running, Game Over etc) and holds a public reference to the Game Over UI Object
  4. When the game is over enable the UI object

This is a little cheaper than loading a new scene (as you don't have the overhead of waiting for an additive scene load), but both are valid approaches. You can also use the same approach as above to control pause menus.

I addition, you may also be interested in Modal Windows, for when you need to ask a player a question (for example, 'Do you really want to start again?')


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .