6 Minute PAUSE MENU Unity Tutorial

Поделиться
HTML-код
  • Опубликовано: 17 май 2020
  • Unless you're purposefully omitting one, chances are your game will need some sort of Pause Menu. This Unity Tutorial will walk you through the essentials of setting one up in just a few minutes.
    It might not be a 5 minute tutorial, but it's close enough for me :)
    Heres the game I made for Ludum Dare 46: • I Made A Game Within 4...
    ✨Want to support the channel?
    Buy me a coffee ☕: ko-fi.com/bmoli
    ➤Join the new DISCORD SERVER: / discord
    ➤Want to make video games? Start with my tutorial Playlist: • Epic Unity Tutorials
    ➤5 Minute Tutorial Series: • 5 Minute Games
    ➤Don't forget to SUBSCRIBE for all the upcoming content.
    #bmo #unity #tutorial

Комментарии • 288

  • @moosica5040
    @moosica5040 2 года назад +98

    Make sure to put isPaused = false; at the end of the GoToMainMenu function, so that you can enable inputs if you decide to click play in the main menu!

    • @alehunter15
      @alehunter15 2 года назад +4

      Thank you for this comment!

    • @lucasquaroni3120
      @lucasquaroni3120 Год назад +4

      THANk YOU

    • @austinschaefer804
      @austinschaefer804 8 дней назад

      I copied the code to the T and I keep getting errors like 'Time' does not contain a definition for 'timescale'. 'PauseMenu.isPaused' cannot be used like a method. And Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement. WHAT DO I DO?

  • @Feinei
    @Feinei 4 года назад +18

    Thanks for making it simple and to the point. I appreciate the lack of useless filler that most people go for

    • @BMoDev
      @BMoDev  3 года назад +2

      Thanks for the kind feedback!

  • @dumpling_dev
    @dumpling_dev 10 месяцев назад +3

    thank you so much for sharing your videos with us, I feel like I honestly learn more from you than the coding courses I've been taking !! You're very good at what you do :)

  • @minna633
    @minna633 3 года назад +1

    Thanks for the tutorial ! It's very nice and I really needed that !!
    Looking forward your next 5min videos !!

  • @Rob-fi2pe
    @Rob-fi2pe Год назад +1

    This is perfect. Thank you for the efficient rundown!

  • @Ik0nino
    @Ik0nino 4 года назад +28

    your videos are super well made, beginner friendly, and perfect for game jams! please continue making tutorials!

    • @BMoDev
      @BMoDev  4 года назад +2

      That makes me really happy you think that, no plans to stop yet!

    • @shaiai6510
      @shaiai6510 3 года назад

      @@BMoDev I 100% agree with this guy, every question i've had in the past 24 hours your channel has answered in the most accessible way. Thank you!

  • @tobysto
    @tobysto 3 года назад +45

    having a youtuber that makes content on exactly what i need and in 2020 is godly. thanks!

  • @RandomDude00001
    @RandomDude00001 13 дней назад

    I wish all tutorials were like this you know very short direct to the point and entertaining.

  • @pavelpavel4029
    @pavelpavel4029 Год назад +1

    Even though you had project of yours that has already been nearly completed, you've successfully shown my dumb ass how to solve this particular "problem". Thank you so much

  • @loganfowler777
    @loganfowler777 2 года назад +1

    bro finna be honest THIS GUY SOUNDS AWESOME his voice is so calming and soothing. Never got a more awesome experience from coding thanks man.

    • @BMoDev
      @BMoDev  2 года назад

      Thats crazy to me, but I appreciate it 💙

  • @OKAYGUVBear
    @OKAYGUVBear 3 года назад +2

    Thank you so much for this, you´re a life saver!

  • @happyshabbygames
    @happyshabbygames 6 месяцев назад

    You're the Goat. Helped me out a ton.

  • @Cjoudan
    @Cjoudan Год назад

    thank you for this great video, plain and simple!

  • @drewity
    @drewity 9 месяцев назад

    Amazing tutorial. Many thanks!!

  • @jerozero755
    @jerozero755 2 года назад +1

    Dude you are my new god, thank you so much :D

  • @zainkheraj4989
    @zainkheraj4989 4 года назад +14

    these tutorials are so useful for my game development, keep up the great content

    • @BMoDev
      @BMoDev  4 года назад +3

      This really makes me happy to hear! Will do my best 🙏 I want more people bringing their ideas to life!

  • @carlosrd9901
    @carlosrd9901 6 месяцев назад

    Thank you!! Your videos are awesome

  • @monkeypwners
    @monkeypwners 9 месяцев назад

    This helped me so much thank you kind stranger

  • @martinlahitou710
    @martinlahitou710 3 года назад +11

    Tip: If your pause menu spams like a minigun when you press Escape, you can change the if (Input.GetKey(KeyCode.Escape)) to if (Input.GetKeyDown(KeyCode.Escape)).

    • @alehunter15
      @alehunter15 2 года назад

      hahahah epic comment!
      +i want to thank you for this gem! I have been trying for hours to fix it!

  • @ayushsinghchauhan9558
    @ayushsinghchauhan9558 5 месяцев назад

    ThankYou so much dude your vids been helping out a lot recenly

  • @Ayyouboss
    @Ayyouboss 3 года назад +3

    Why the hell are you so underrated? These are some straight on point Tutorials man! Thanks

  • @FeeFox
    @FeeFox Год назад

    Helped so much! 👍

  • @cool_gamertag4488
    @cool_gamertag4488 2 года назад

    I came across this video and it helped fix a bug in my pause menu so THANK YOU =>

  • @franciscospinola7883
    @franciscospinola7883 2 года назад

    Ty so much, you helped me a lot!!

  • @Chrissspyy
    @Chrissspyy 3 года назад +7

    i followed brackeys tutorial on the same topic and it wouldnt work for me! i tried this one and it worked perfectly! thank you so much! im new to programming and video game development and your video just helped me out alot... you just gained a sub

    • @BMoDev
      @BMoDev  3 года назад +1

      Happy to hear it! Keep it up!

    • @Chrissspyy
      @Chrissspyy 3 года назад

      BMo thanks!

    • @alexthompson8977
      @alexthompson8977 2 года назад +1

      @@BMoDev for some reason the player is blocking the pause menu buttons from working

  • @Emilis2023
    @Emilis2023 Год назад +3

    Perfect, thanks! I'm just starting with all this and being able to set the timescale was the piece of the puzzle I was missing. Until now I had been setting a bool for "canMove" to false and wrapping it around every single movement command on my character but I was wondering what I would do about enemies and other environmental objects. I knew I could always give them something similar, but then having to tie all that in to a player pressing a key seemed awfully excessive. This looks like a much better solution!

    • @Emilis2023
      @Emilis2023 Год назад +2

      Now that I think about it, I guess this is also where you could add a feature like Rimworld has where you have multiple play speed buttons or special effects like time slowing when you get hit with a fatal blow. Really good to know!

  • @mcleverm01
    @mcleverm01 2 года назад

    Thanks! Good video!

  • @MemesButSpicy
    @MemesButSpicy 3 года назад +7

    And you can qui...
    Im learning with your tutorials thanks a lot :)

    • @BMoDev
      @BMoDev  3 года назад +2

      Awesome, keep it up!

  • @riniton9217
    @riniton9217 3 года назад +3

    very quick and to the point, I appreciate that :]

  • @firizz
    @firizz Год назад

    Very helpful! thanks

  • @BossAleks123
    @BossAleks123 Год назад

    Great video thx : )

  • @peperoni7789
    @peperoni7789 3 года назад +1

    again, i search "Unity 2d pause menu" and the second video is this one, like the other, i'm not disappointed, i think i'm going to subscribe x)

    • @peperoni7789
      @peperoni7789 3 года назад

      I just have a little probleme, when i click on "resume" the first time, the next time i open the pause menu, if i press space the pause menu closed, even if my "space" button don't serve any purpose, not a big deal, but i'm curious to know why

  • @MajesticMindGames
    @MajesticMindGames Год назад

    You're a beautiful human being Mr.BMo.

  • @semiuodunayoadebayo6299
    @semiuodunayoadebayo6299 5 месяцев назад

    Thanks a lot, much appreciated

  • @adfaawda3798
    @adfaawda3798 4 года назад +1

    Awesome tutorial. I have a pause menu now.

    • @BMoDev
      @BMoDev  4 года назад +1

      Nice work!

  • @hiltop5190
    @hiltop5190 2 года назад

    Thanks that's help me a lot

  • @kizune3322
    @kizune3322 3 года назад +1

    i love your videos

  • @cristhinareyes9108
    @cristhinareyes9108 Год назад +6

    Hey, so idk if youll see this but , My problem is that when the game is up the text choices "resume , quit " etc are overlayed on the game and it wont disappeared . they do work when I hit esc and the paused title comes up but the choices never leave?

  • @jimbodii8958
    @jimbodii8958 3 года назад +12

    If you guys are getting a "Non assigned error". Put your pause script on an empty object outside your canvas then assign the PauseMenu object to your script after that make sure you don't have duplicates of the script.

    • @canofbeansproductions
      @canofbeansproductions Год назад +1

      how do you assign the PauseMenu object to your script?

    • @jw5172
      @jw5172 Год назад

      @@canofbeansproductions I think they meant assign the script to the empty object, which you can do by dragging the PauseMenu script onto the empty object in the Hierarchy where you made it.

    • @canofbeansproductions
      @canofbeansproductions Год назад

      @@jw5172 After 4 months i just figured this out about a week ago lmao

    • @magicsink6930
      @magicsink6930 Год назад

      THANK YOU SIR!!!!!!!!!😭

    • @hajas7352
      @hajas7352 День назад

      @@jw5172 BRO U JUST SAVE MY ASS!!!!! THANK U SO MUCH

  • @goldsucher8578
    @goldsucher8578 3 года назад +6

    5:48 what is my gameManager ? the Camara ?

  • @brejnastore
    @brejnastore 3 года назад +12

    Tip: you actually cant put script everywhere u want (not on PauseMenu because script wont work if u disable gameobject :D)

    • @thomashoger5548
      @thomashoger5548 11 месяцев назад

      Good advice, i had that problem n now i know how to solve it. Thanks

  • @Nana-nt1ix
    @Nana-nt1ix 3 года назад +6

    Is "pauseMenu" the name of an existing object or is it assigned to the menu by the script?

  • @imlarahi4255
    @imlarahi4255 3 года назад +5

    Hey, great tutorial! I was wondering if there's a way to stop the Standard Assets FPS Controller from letting the player still move the camera around when the pause menu is up, haven't been able to figure it out myself. Thank you!

    • @oscarverhagen1329
      @oscarverhagen1329 Год назад +2

      Cursor.lockState = CursorLockMode.None;
      Cursor.visible = true;
      player.SetActive(false);

  • @Romope
    @Romope 3 года назад

    Hi, thanks for the video!
    To stop receiving inputs for the gamepad(it's moving the character even when paused) e still making it available to navigate the menu, how do I achieve that?

  • @t.c4969
    @t.c4969 2 года назад +3

    Hi, I'm just wondering I don't have a game manager and I don't know where to put the script so it's not working could you please tell me how where to actually put the script if I don't have a game manager?

  • @motox4577
    @motox4577 3 года назад +1

    So I have a fade into scene ui in my project, and so now my buttons don’t press because of it. Anyway to fix this? Thanks

  • @beratcakr5316
    @beratcakr5316 3 года назад

    thx my bro

  • @LegendaryNassa
    @LegendaryNassa 2 года назад +7

    Make sure that you change isPaused bool to false in the Main menu function, otherwise your controls will be locked when you play again

    • @savokar
      @savokar 2 года назад +2

      thanks i'll trying all day to find out

  • @frong22
    @frong22 8 месяцев назад

    thanks you guy

  • @yusufkaancan7358
    @yusufkaancan7358 Год назад

    nice Video (:

  • @nickolasmachado9274
    @nickolasmachado9274 3 года назад

    thank you

  • @silver8349
    @silver8349 3 года назад

    Hello, I followed the tutorial and I like it! but it seems there is a problem happening to me, when I pause the game my Standard FPS controller still rotating any advise?

  • @wahl7890
    @wahl7890 2 года назад +1

    'PauseMenu' does not contain a definition for 'isPaused'-error is popping up. how do i fix this?

  • @davidspurny3384
    @davidspurny3384 3 года назад +2

    Smashed the like as hard as I could have

    • @BMoDev
      @BMoDev  3 года назад +2

      My man 🙏

    • @tobysto
      @tobysto 3 года назад

      *smash that like button two times!*

  • @Dreams004
    @Dreams004 2 года назад +3

    When I press escape pause menu doesn't show up any solution?🥺

  • @nish3003
    @nish3003 10 месяцев назад

    how could i make a pause menu for a multiplayer fps game? because when I press escape, the cursor still moves my camera for whatever reason, even if I have an if else condition in place to prevent that

  • @eggzeatpeggz
    @eggzeatpeggz 3 года назад +1

    im using the same version as you and before you did the static ball and yeah in my 3d it doesnt work

  • @lokine421
    @lokine421 2 года назад

    How do you fix it so it works after you have buildt and run the game? Only works in game tab in the editor but not in the buildt version

  • @chamalie9839
    @chamalie9839 2 года назад

    Arigatou senpai 🙏

    • @BMoDev
      @BMoDev  2 года назад

      Dou itashimashite

    • @chamalie9839
      @chamalie9839 2 года назад

      @@BMoDev ah yes, a true weebu

  • @lshc0304
    @lshc0304 Год назад +1

    for those who have issue with UnassignedReferenceException error, go chack out "PAUSE MENU in Unity" by Brackeys, he did it in a slightly different way and it works

  • @bluecrazyclown._.9865
    @bluecrazyclown._.9865 7 месяцев назад

    Hi- I’m using SC_FPSController script and I can’t freeze the the camera moving with the mouse (so can’t stop player movement)
    Should I unconnected them so solve that??

  • @ezzyrappeport8856
    @ezzyrappeport8856 2 года назад

    ok but now how do i make it work... like i do make pressing the quit game button quit the game and make the resume game resume it when you click it or the back to menu take me to the main menu

  • @mohammadumarsajid8214
    @mohammadumarsajid8214 Год назад

    why my functions (pauseGame(), resumeGame()) are not appearing in inspector when on click() .. i have put the the script in separate gameobject and applied this game object in on click() .. still not functions of the script appearing, why?

  • @thegymteachersgrandma
    @thegymteachersgrandma Год назад

    I'm using this for a VR game, however with this script i cannot interact with the buttons, without the script i can. Any ideas how to fix that?

  • @romeprince11
    @romeprince11 Год назад +2

    Doesn't work for me im getting and issue with assigning it to a game object
    The game is freezing when I hit esc but there is no menu popup
    Im trying to figure it out right now but there's an issue with setting the script to something, and then putting something as a the gameobject for pausemenu
    Edit - I believe it has something to do with the camera settings
    Edit 2 - Yes it was the canvas, once I set it to follow the camera it made my already small menu microscopic.
    So I saved a copy of the panel, made the change, then repasted the panel and it's perfect. Now my pause menu follows my camera screen which is what I wanted.
    You need to set the pausemenu as a gameobject in the pause menu script
    Edit 3 - You cannot call PauseMenu from another CS script it does not exist
    You have to import it

  • @weckar
    @weckar 9 месяцев назад +1

    While this method is great for tiny games, hard setting the timescale will often lead to issues in larger games.

  • @felizeumida4374
    @felizeumida4374 Год назад

    I've used your code to make a death screen, but when i die my mouse doesn't show up, do you know why this is?

  • @jaymhlurbaloyi7813
    @jaymhlurbaloyi7813 3 года назад

    unity gives me an error saying " PauseMenue does not have a definition for SetActive" on top of that the public gameObject does not appear in the scripts inspector. Can anyone help?

  • @spkzyes9536
    @spkzyes9536 2 года назад

    Someone please help quick when I click esc the pause menu doesnt go away and it updates my game if i do it again

  • @thegreatside6059
    @thegreatside6059 4 года назад

    when i press play the game goes on but when i press the esc button it will not show up. can someone help me?

  • @ThescreamingRooster
    @ThescreamingRooster Год назад

    i got the menu button and quit button to work but i cant resume the game or push escape to take the menu away

  • @kirsteinwandah
    @kirsteinwandah 3 года назад

    What vs code extensions do u use for unity

  • @Skellens
    @Skellens 4 года назад +4

    Can you make a gameover menu thing couse i'm stuck with things like that

    • @BMoDev
      @BMoDev  4 года назад +2

      Sure, I'll add it to my backlog

  • @catnzip
    @catnzip 3 года назад

    my main menu is stuck for some reason after going from the pause menu, what could be the problem ?
    i hope someone answers asap really need it for school

  • @MCShvabo
    @MCShvabo 2 года назад

    Hey, this keeps happening to me. If I go back to the main menu, it's frozen, I can't click anything, can someone help?

  • @TomasPower123
    @TomasPower123 21 день назад

    if i was making a 3D game how would i stop my camera from moving around when im in the menu

  • @JonelKingas
    @JonelKingas 10 месяцев назад +2

    im using both youtube tutorials and chatgpt both help a lot. first i get what i want on youtube than expand with chatgpt, and im actually learning.

  • @naruto40kiba30
    @naruto40kiba30 2 года назад

    Hmm I'm pressing the button but the menu does not come up. I already added the gameobject to the script as well. Can anyone help?

  • @augustoliver715
    @augustoliver715 2 года назад

    I know this video is super old and no one cares, but is the audio from the beginning from Juice Universe? (I believe that's what it's called now after it got renamed)

  • @DoDoCardoso
    @DoDoCardoso 2 года назад

    When i go to "on click()" - button i dont have the options that u have

  • @MaZyYTube
    @MaZyYTube 3 года назад

    What if you have animations and want to use them? Example you have options button and want to make it slide in the option screen if you click on it.

    • @FOLDIK_UA
      @FOLDIK_UA 4 месяца назад +1

      sail to Ukraine🙂

  • @GarrettMcNamaraLang
    @GarrettMcNamaraLang Год назад

    when I run my game the escape key doesn't work, and I followed this video by the second so does anyone know why that's happening.

  • @huygtuy
    @huygtuy 7 месяцев назад

    When i make a build of my game, and i click Escape two times, the screen gets blurry and i cant play my game anymore. Anyone any suggestions?

  • @FNAFgorilla
    @FNAFgorilla 11 месяцев назад

    Hi my script isnt working and would like help my script is making the buttons work

  • @JoaoVitor-oc3xq
    @JoaoVitor-oc3xq 3 года назад +2

    Someone help me please! is giving the error: "The name (Principal) is not in the context csharpCS0103".
    This code would be to change the scene, in this case it would be for the Main Menu scene, I changed the scene name to "Principal" but it will not go at all!

    • @onx99
      @onx99 3 года назад

      That could be referring to the UI element.

    • @gamer-revolution
      @gamer-revolution 3 года назад

      That happend to Me too

    • @gamer-revolution
      @gamer-revolution 3 года назад

      Coz ist fake

    • @adhviklalthoppe2214
      @adhviklalthoppe2214 2 года назад

      This is very late but the way to fix this (i think) is to
      1.) Go to the top left
      2.) Click on file
      3.) Click on build settings
      4.) Drag and drop all your scenes into the big space (make sure you drag them into the order you want people to see it in)

  • @tomaspinto4492
    @tomaspinto4492 11 месяцев назад

    you're a fucking legend.

  • @__-dc1no
    @__-dc1no 3 года назад

    i'm with the following error
    Assets\scripts\PauseMenu.cs(45,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement

    • @BMoDev
      @BMoDev  3 года назад

      That's a syntax error. Please share your code, we have a channel in our discord to help with these issues! (Should be a quick fix)

  • @bensmart2829
    @bensmart2829 4 года назад

    Out of curiosity, why do you use vscode over visual studio, especially in unity?

    • @BMoDev
      @BMoDev  4 года назад +4

      2 Main reasons
      1. VS Code is cross platform out of the box
      2. Visual Studio is a full fledged IDE and comes with powerful tools to build unrelated software like Web Applications. Compared to VS Code which is just a text editor, Visual Studio is bloated.

    • @bensmart2829
      @bensmart2829 4 года назад

      @@BMoDev makes sense. Thank you for replying!

    • @Romope
      @Romope 3 года назад

      I don't know about VSCode, but VStudio has a debugger

  • @unluckyaf7673
    @unluckyaf7673 3 года назад +3

    UnassignedReferenceException: The variable pauseMenu of PauseMenu has not been assigned.
    You probably need to assign the pauseMenu variable of the PauseMenu script in the inspector.
    PauseMenu.PausedGame () (at Assets/Scripts/PauseMenu.cs:35)
    PauseMenu.Update () (at Assets/Scripts/PauseMenu.cs:23)

    • @tobysto
      @tobysto 3 года назад

      just assign the variable

    • @TBag-xl9qz
      @TBag-xl9qz 6 месяцев назад

      How i can do this?

    • @TBag-xl9qz
      @TBag-xl9qz 6 месяцев назад

      ​@@tobystohow?

    • @unluckyaf7673
      @unluckyaf7673 6 месяцев назад +1

      Oh my god, it's been 3 fucking years, I was so dumb bro 😂

    • @unluckyaf7673
      @unluckyaf7673 6 месяцев назад

      @@TBag-xl9qz google "how to assign a variable in C#" or in these days ask chatgpt

  • @jmekerjmk8353
    @jmekerjmk8353 3 года назад

    i have a question with this script and menu , when i open my game the menu appear on game whit pressing nothing ,how i resolve this?

    • @jpmb1808
      @jpmb1808 3 года назад

      maybe a little bit late to this question but you can dissable a gameobject on top in the inspector right besides the name of that said object

  • @dartpi1436
    @dartpi1436 Год назад

    I don't have anything like GameManager... What gameObject should I put into "On click" event instead?

    • @FNAFgorilla
      @FNAFgorilla 11 месяцев назад

      canvas

    • @FNAFgorilla
      @FNAFgorilla 11 месяцев назад

      you put the scirpt in the canvas

  • @crafthuntofficial
    @crafthuntofficial 2 года назад

    everything is working but when i press back to menu my cursor locks again

  • @avalanche9223
    @avalanche9223 2 года назад

    i don't have a PauseMenu function. can someone explain why? thanks in advance.

  • @emanmane
    @emanmane 3 года назад

    How can I make the escape button android friendly?

  • @andy95summer
    @andy95summer 3 года назад

    UnassignedReferenceException: The variable pauseMenu of PauseMenu has not been assigned.
    You probably need to assign the pauseMenu variable of the PauseMenu script in the inspector.
    PauseMenu.Start () (at Assets/Scripts/PauseMenu.cs:14)
    PauseMenu.ResumeGame() (at Assets/Scripts/PauseMenu.cs:42)
    what I miss or did wrong?

  • @goldsucher8578
    @goldsucher8578 3 года назад

    UnassignedReferenceException: The variable pauseMenu of PausedMenu has not been assigned.
    You probably need to assign the pauseMenu variable of the PausedMenu script in the inspector.
    PausedMenu.Start () (at Assets/Scrips/PausedMenu.cs:13)
    what did i Wrog :C

    • @shyanneautumn3461
      @shyanneautumn3461 3 года назад

      in the script drag the pausemenu into the scripts place where it says
      Pause Menu [ ]

  • @Subaru69420
    @Subaru69420 3 года назад

    add eventsystem if you cant click on any buttons to your hierarchy

  • @mehdib1781
    @mehdib1781 3 года назад

    I HAVE A PROBLEM
    Escape button do not work and i checked in the setting in the Input Manager to affect the name in the code as the name of the button in the settings...
    PLEASE HELP

    • @shyanneautumn3461
      @shyanneautumn3461 3 года назад

      unity has a defult setting that makes the escape key allow you to move your mouse outisde the game viewer to exit play mode, i set it to Q for me for testing purposes

    • @bluecrazyclown._.9865
      @bluecrazyclown._.9865 7 месяцев назад

      I would change it to “…GetKeyDown(KeyCode.P)) “
      For it to work as when playing a game you don’t really want to press “esc” as takes away from immersion

  • @ojaskalra4863
    @ojaskalra4863 10 месяцев назад

    For some reason my buttons aren't working at all, can't click or hover on them. Any possible causes?

  • @good_noodlewastaken
    @good_noodlewastaken Год назад

    does anybody know how to make it not lock back to the camera if im making a fps game?