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
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!
Thank you for this comment!
THANk YOU
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?
Thanks for making it simple and to the point. I appreciate the lack of useless filler that most people go for
Thanks for the kind feedback!
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 :)
Thanks for the tutorial ! It's very nice and I really needed that !!
Looking forward your next 5min videos !!
This is perfect. Thank you for the efficient rundown!
your videos are super well made, beginner friendly, and perfect for game jams! please continue making tutorials!
That makes me really happy you think that, no plans to stop yet!
@@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!
having a youtuber that makes content on exactly what i need and in 2020 is godly. thanks!
I wish all tutorials were like this you know very short direct to the point and entertaining.
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
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.
Thats crazy to me, but I appreciate it 💙
Thank you so much for this, you´re a life saver!
You're the Goat. Helped me out a ton.
thank you for this great video, plain and simple!
Amazing tutorial. Many thanks!!
Dude you are my new god, thank you so much :D
these tutorials are so useful for my game development, keep up the great content
This really makes me happy to hear! Will do my best 🙏 I want more people bringing their ideas to life!
Thank you!! Your videos are awesome
This helped me so much thank you kind stranger
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)).
hahahah epic comment!
+i want to thank you for this gem! I have been trying for hours to fix it!
ThankYou so much dude your vids been helping out a lot recenly
Why the hell are you so underrated? These are some straight on point Tutorials man! Thanks
Helped so much! 👍
I came across this video and it helped fix a bug in my pause menu so THANK YOU =>
Ty so much, you helped me a lot!!
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
Happy to hear it! Keep it up!
BMo thanks!
@@BMoDev for some reason the player is blocking the pause menu buttons from working
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!
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!
Thanks! Good video!
And you can qui...
Im learning with your tutorials thanks a lot :)
Awesome, keep it up!
very quick and to the point, I appreciate that :]
Very helpful! thanks
Great video thx : )
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)
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
You're a beautiful human being Mr.BMo.
Thanks a lot, much appreciated
Awesome tutorial. I have a pause menu now.
Nice work!
Thanks that's help me a lot
i love your videos
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?
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.
how do you assign the PauseMenu object to your script?
@@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.
@@jw5172 After 4 months i just figured this out about a week ago lmao
THANK YOU SIR!!!!!!!!!😭
@@jw5172 BRO U JUST SAVE MY ASS!!!!! THANK U SO MUCH
5:48 what is my gameManager ? the Camara ?
Tip: you actually cant put script everywhere u want (not on PauseMenu because script wont work if u disable gameobject :D)
Good advice, i had that problem n now i know how to solve it. Thanks
Is "pauseMenu" the name of an existing object or is it assigned to the menu by the script?
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!
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
player.SetActive(false);
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?
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?
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
thx my bro
Make sure that you change isPaused bool to false in the Main menu function, otherwise your controls will be locked when you play again
thanks i'll trying all day to find out
thanks you guy
nice Video (:
thank you
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?
'PauseMenu' does not contain a definition for 'isPaused'-error is popping up. how do i fix this?
Smashed the like as hard as I could have
My man 🙏
*smash that like button two times!*
When I press escape pause menu doesn't show up any solution?🥺
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
im using the same version as you and before you did the static ball and yeah in my 3d it doesnt work
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
Arigatou senpai 🙏
Dou itashimashite
@@BMoDev ah yes, a true weebu
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
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??
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
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?
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?
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
While this method is great for tiny games, hard setting the timescale will often lead to issues in larger games.
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?
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?
Someone please help quick when I click esc the pause menu doesnt go away and it updates my game if i do it again
when i press play the game goes on but when i press the esc button it will not show up. can someone help me?
i got the menu button and quit button to work but i cant resume the game or push escape to take the menu away
What vs code extensions do u use for unity
Can you make a gameover menu thing couse i'm stuck with things like that
Sure, I'll add it to my backlog
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
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?
if i was making a 3D game how would i stop my camera from moving around when im in the menu
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.
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?
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)
When i go to "on click()" - button i dont have the options that u have
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.
sail to Ukraine🙂
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.
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?
Hi my script isnt working and would like help my script is making the buttons work
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!
That could be referring to the UI element.
That happend to Me too
Coz ist fake
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)
you're a fucking legend.
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
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)
Out of curiosity, why do you use vscode over visual studio, especially in unity?
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.
@@BMoDev makes sense. Thank you for replying!
I don't know about VSCode, but VStudio has a debugger
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)
just assign the variable
How i can do this?
@@tobystohow?
Oh my god, it's been 3 fucking years, I was so dumb bro 😂
@@TBag-xl9qz google "how to assign a variable in C#" or in these days ask chatgpt
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?
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
I don't have anything like GameManager... What gameObject should I put into "On click" event instead?
canvas
you put the scirpt in the canvas
everything is working but when i press back to menu my cursor locks again
i don't have a PauseMenu function. can someone explain why? thanks in advance.
How can I make the escape button android friendly?
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?
I have the same problem and I can't figure it out
Same here
Same
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
in the script drag the pausemenu into the scripts place where it says
Pause Menu [ ]
add eventsystem if you cant click on any buttons to your hierarchy
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
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
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
For some reason my buttons aren't working at all, can't click or hover on them. Any possible causes?
You might not have an EventSystem?
does anybody know how to make it not lock back to the camera if im making a fps game?