My Favorite Way To Make A GAME OVER Menu In Unity

A Game Over menu is actually incredibly simple, but how to implement one really can depend on the type of game your making.
With the approach discussed in this Unity Tutorial I'll cover how to use Events so regardless of the genre of your game and the condition of your "Game Over" you'll be able to adapt this to any project in a clean way.
Comment down below if you need any help understanding anything!
✨Want to support the channel?
Buy me a coffee ☕: ko-fi.com/bmoli
➤SUBSCRIBE to not get a game over
~~
➤LIKE the video if you enjoyed, it really helps the channel!
➤Join our DISCORD SERVER: / discord
We have channels to help you with your problems!
Thanks for watching!
#bmo #unity #tutorial

Пікірлер: 42

  • @GBSCronoo
    @GBSCronoo2 жыл бұрын

    This is my new favorite tutorial channel 👍

  • @alexh3027
    @alexh30272 жыл бұрын

    These videos are just so clear. This video has clicked a whole bunch of your other videos into place in my head and now I feel I have events clarified in a context I needed. My game is already much cleaner through your tutorials. So thank you

  • @BMoDev

    @BMoDev

    2 жыл бұрын

    super gratifying to hear that, thanks!

  • @revmatch6r
    @revmatch6r2 жыл бұрын

    Great vid dude. Really love event driven architecture even outside of game dev

  • @FernandoDenise2558
    @FernandoDenise25582 жыл бұрын

    Really well done video, thank you!

  • @falkkuhnel5298
    @falkkuhnel52982 ай бұрын

    Just to mention it, you can use Actions with parameters: public static Action OnDamage for example to pass an integer as the amount of damage to take.

  • @Stompin40
    @Stompin402 жыл бұрын

    Wonderful video!

  • @suicune2001
    @suicune20012 жыл бұрын

    Thanks! I like making the game over screen a different scene so I don't have to worry about disabling and enabling stuff.

  • @BMoDev

    @BMoDev

    2 жыл бұрын

    Yeah thats a much simpler way, thought itd be more useful to show an in game menu, but sometimes im lazy and just change scenes, especially in game jams lol

  • @godzillakingkongvenom
    @godzillakingkongvenom2 жыл бұрын

    Lovin the pace here! Great vid

  • @fryptompt
    @fryptompt Жыл бұрын

    thank you so much sir!!

  • @_Garm_
    @_Garm_2 жыл бұрын

    Great stuff! :D

  • @BMoDev

    @BMoDev

    2 жыл бұрын

    Thanks!

  • @majou675
    @majou675 Жыл бұрын

    the best tutoriall!!!!!

  • @johnrayaniag6841
    @johnrayaniag68412 жыл бұрын

    hey may i ask if how will the death animation work once the GameOverScreen comesout?

  • @animationsbelike
    @animationsbelike2 жыл бұрын

    Nice! :D

  • @DextraVisual
    @DextraVisual Жыл бұрын

    My PlayerHealth has an OnDestroy(object); instruction instead of OnPlayerDeath. Will the Destroy work in its place without having to replace and relink all of my player scripts with your Health script?

  • @TheOnlyKaas
    @TheOnlyKaas2 жыл бұрын

    Is it possible to have the code files in a google drive or something, because this doesn't work for me right now it just does nothing.

  • @catherinestafford9712
    @catherinestafford97122 жыл бұрын

    BRO. thanks. this is sick, please keep making videos. extremely dig the way you talk and explain things

  • @BMoDev

    @BMoDev

    2 жыл бұрын

    Thanks! Appreciate that

  • @muhamadabdullah1391
    @muhamadabdullah1391 Жыл бұрын

    unity cannot accept (Action) as a datatype despite i wrote using system; in the top of the script can u tell me why ?

  • @ashtonobrien1043
    @ashtonobrien10432 жыл бұрын

    Dont know why but my player stays static whenever I click the restart button, like I know why because it disables movement and doesnt enable it again because it only enables it again on void start like what did I miss

  • @eeezxbxzkgjzgvjzcyjvgz
    @eeezxbxzkgjzgvjzcyjvgz Жыл бұрын

    hey for some reasin i cant see my buttons or texts and more but they are there, also the screen dosent pop up for me (I saw the buttons and stuff before) does anyone have any idea why

  • @saylasgrivz
    @saylasgrivz Жыл бұрын

    thanks

  • @anythingpeteives
    @anythingpeteives2 жыл бұрын

    But why is there a private void OnDisable method which has -= EnableGameOverMenu. That seems to do nothing. Is it even needed?

  • @KBforJesusChrist
    @KBforJesusChrist Жыл бұрын

    Timer out lose condition I'm a complete beginner trying to make a game I'm stuck on the time out trigger lose I haven't found a tutorial talking about it

  • @risingforce9648
    @risingforce96486 ай бұрын

    whatis your visual studio theme? or you are using a custom editor to change user-methods,delegate,etc??? I do not like Monokai is too noise for me!! but your theme is cool , I am trying to find something cool to not distract my attention, I use the default one,but I just change some things in the color of property and local variables.

  • @durrium
    @durrium2 жыл бұрын

    I don't really get this.. What is the difference of just having a normal function which will get called on death? :)

  • @CoreyBarlow
    @CoreyBarlow Жыл бұрын

    Assets\Scripts\UIManager.cs(24,22): error CS1061: 'GameObject' does not contain a definition for 'SetAcive' and no accessible extension method 'SetAcive' accepting a first argument of type 'GameObject' could be found (are you missing a using directive or an assembly reference?) any ideas? iv also tried GameOverMenu.gameObject.SetAcive(true); but this didn't work either

  • @CoreyBarlow

    @CoreyBarlow

    Жыл бұрын

    im an idiot, i misspelt active

  • @OmeedNOuhadi
    @OmeedNOuhadi Жыл бұрын

    👏👏👏

  • @eileeng2492
    @eileeng24922 жыл бұрын

    I actually think I understand it after this video. Thanks

  • @branidev
    @branidev2 жыл бұрын

    cool

  • @FNNYNTFND
    @FNNYNTFND Жыл бұрын

    great video and if you are tryng to make the player not move on 3d try this public void EnableGameOverMenu() { GameOverMenu.SetActive(true); Player.gameObject.GetComponent().enabled = false; } hope i helped

  • @kaz7342

    @kaz7342

    Жыл бұрын

    it worked thanks bro

  • @a-minus-b-equals-a
    @a-minus-b-equals-a2 жыл бұрын

    Note that doing it in this way will lock you out from creating multiplayer/co-op games. If you later decide to make your game co-op, you'll need to change lots of logic. Static things are comfy, but they are inflexible and untestable.

  • @BMoDev

    @BMoDev

    2 жыл бұрын

    Static variables being Inflexible is a fair enough point, but you can absolutely make a local multiplayer game with this method. Its literally just an event, theres no reason you cant track multiple players and have a gameover screen show when theyve met the lose condition.

  • @a-minus-b-equals-a

    @a-minus-b-equals-a

    2 жыл бұрын

    ​@@BMoDev If you write a single-player game with this method and later decide to add multiplayer, you'll have to rewrite a lot of stuff to support it. Of course, in a "if one dies everyone loses" scenario it doesn't matter, but if you want to add respawning mechanics and the likes, it's going to be a mess. For example: the lack of a sender parameter. With the event you've created, the subscribers have no easy way of finding out who called them. What will you do if there's multiple PlayerHealth? An obvious solution is to add the PlayerHealth(or, even better, an identifier for the specific player) to the Action's parameters, but that will require changing all subscribing classes & methods to accommodate the new parameter. Little things like that accumulate until making a change means rewriting half the application. It's, of course, not limited to just this method. The reason I've written this comment at all is because I think it's VERY important to reflect before making a static method/variable/whatever. It's important to consider whether it will hinder you in the future, were you to decide to add/change something. So, I'm against giving these kinds of suggestions in tutorials. A place where I would use static(though, in this case, a straightforward const would work better) is for scenes names. I'd just put them all in a static class. That way you won't need magic strings/integers when changing the scene with SceneManager.LoadScene(); which will also allow you to change scenes' names without breaking any code(as you'd only need to update the static class's const string).

  • @Barldon

    @Barldon

    11 ай бұрын

    @@a-minus-b-equals-a Late reply, but that is an incredibly simple solution. Instead of having an event on the class, you have it on an interface, which means it doesn't matter which class implements the event. You can attach a sender either as you stated, or you can use the EventHandler class instead of the Action class, which automatically attaches a sender. I'd be interested to know what method you feel suits this better than statics, as I've yet to see a convincing argument for another implementation.

  • @a-minus-b-equals-a

    @a-minus-b-equals-a

    11 ай бұрын

    ​@@Barldon The issue isn't that there's no solution-the issue is that applying a different solution in late development will require manually editing all the existing callers(and if you use this kind of pattern a lot, that could mean whole rewrites). This applies both to my solution and to the usage of a EventHandler. Said that, I'm kinda confused on how moving the event to an interface will help identify which player launched the event. The main point to consider is that static things are inflexible, hard to mock, and hard to modify late in development-they're imho more reserved for things that semantically will never change(like math-related stuff). For small projects and things with clear scopes this is mostly fine(basically trading off flexibility for ease of development), though if you were planning differently I'd put in some system of identifying users from the get-go, whether by passing in an id, or by registering an event for each different player. My only real issue with the static issue here is that it's presented in a beginner-focused tutorial as the "go-to" solution without mentioning the important trade-offs it has.

  • @rushikeshdawange2870
    @rushikeshdawange28702 жыл бұрын

    how many subscribers did you get by repeating this subscribe word