Search Unity

What is the right way to create an 'End of chapter' panel

Discussion in '2D' started by Isheta, Oct 21, 2019.

  1. Isheta

    Isheta

    Joined:
    Aug 9, 2019
    Posts:
    4
    Hi,

    I want to develop a panel which summarize the player's scoring so far.
    Now, the issue is that I show it only when the player has died OR the chapter is done.

    Assuming I have a Level and each level has 10's of chapters, each chapter is a different scene.
    The player might die in any chapter and a summary screen needs to be displayed upon dead or completion.

    I thought about just making a simple panel with a script, which will be instantiated, then i'll set the values in the script and that's it.
    I wanted to dig further just to be sure that is the right way and Ive seen lots of people condemning the use
    of prefab on UI elements because it might affect other UI elements, undesirably.

    I really want to create a panel which is updated once and used all the way in all my level scenes so i dont want to just copy paste it everywhere..

    Any ideas about it should be done?
    Newbie here, thanks.
     
    Last edited: Oct 21, 2019
  2. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    916
    Hello Isheta,

    Creating a general in game UI, with game over overlay, and placing it all inside a prefab, is a pretty popular approach. With this prefab, you could then choose to
    • Drag it out into each and every level
    • Create a "UI Spawner" script, to instantiate the UI at runtime in the current level
    • Create a UI scene which you load additively with your level
    All these approaches work, so try one or two out and see how you feel about the result.

    Best of luck!
     
  3. Isheta

    Isheta

    Joined:
    Aug 9, 2019
    Posts:
    4