Learn how to make a pause menu using Unity!
As mentioned in the video, we’ve already created a start menu and a settings menu. Check them out:
Start menu:
Settings menu:
TextMesh Pro Video:
Get TextMesh Pro:
♥ Support Brackeys on Patreon:
····················································································
♥ Donate:
♥ Subscribe:
● Website:
● Facebook:
● Twitter:
····················································································
Edited by Sofibab & LeBonques.
····················································································
► All content by Brackeys is 100% free. We believe that education should be available for everyone. Any support is truly appreciated so we can keep on making the content free of charge.
····················································································
♪ Baby Plays Electro Games
Nguồn: https://potomacstewards.org/
Xem thêm bài viết khác: https://potomacstewards.org/game/
Xem thêm Bài Viết:
- Classic Game Room – ORBITOR 1 pinball machine review
- Let's Play Flink – Fun with Streaming in a Gaming Company
- A Wii U Promise Finally Fulfilled 9 Years Later! (Clubhouse Games Secret)
- DAYZ #5: VŨ TRỤ MỚI – CLAN "VIET NAM BO DOI" PHẢI QUỲ XIN TIỀN BỌN TÂY =))))
- Playstation Move but it's a terrible harry potter game
why is my text such low quality
Amazing tutorial but ehmmm sometimes CALM DOWN like aaahhhh my brain i know i can pause but you are closing the script so fast that i need to slow down the vid to 0.25x to pause and copy it
How can i at this to a Button????
I literally paused the video at 10:04 and then spent basically 2 hours of my life trying to figure out why everything was being weird.
I learnt my lesson.
my game keeps flashing my menu with this:
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
public class PMenuScript : MonoBehaviour
{
public static bool IfPaused = false;
public GameObject pauseMenuUI;
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape)) ;
{
if (IfPaused)
{
Resume();
}
else
{
Pause();
}
}
}
void Resume()
{
pauseMenuUI.SetActive(false);
Time.timeScale = 1f;
IfPaused = false;
}
void Pause()
{
pauseMenuUI.SetActive(true);
Time.timeScale = 0f;
IfPaused = true;
}
}
Hi, so when I pause the game for the first time I can continue it via the 'resume' button, but when I pause again and try to click the resume button, nothing happens… Anyone know a solution?
What key will be used if it is in android ??
Im really confused its the second time this has happened the "Input.GetKeyDown" doesnt work for me, unity says "input does not contain a definition for GetKeyDown"
ok so seems I have to quit unity. I cant do the get key down so I cant do a lot.. nice one. (I have gone through the video 3 times)
this script doest work
I used it to also make a ZA WARUDO sound effect when clicking on pause just for fun
I don't understand, because my Time.timeScale don't work
It's not pause the game
Still the only Unity tutorial channel I ever manage to properly learn stuff from.
Can you do a video about a pause button that shows the pause menu. When I tried the settings don't work
7:02
I'm trying to get my game to pause in the background when I'm in the menu, it just won't work? Here's my menu script,
using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
public class MainMenu : MonoBehaviour
{
public void mainMenu()
{
SceneManager.LoadScene(0);
}
public void playGame()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
public void continueGame()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
public void QuitGame()
{
Debug.Log("Quit!");
Application.Quit();
}
}
Plus, I can only click on my menu once per level for some reason? Thanks
if your game is paused when you start use this code
void Start()
{
pauseMenuUI.SetActive(false);
Time.timeScale = 1f;
GameIsPaused = false;
}
inactive* object
It doesn't work on 2019.4 version. You need to add the PauseMenu script to Canvas, for example. It doesn't work, bacause script doesn't work on a nonactive object. It needs to be active all the time.
This did not work
It worked dude!!
Thanks
for some reason the buttons do not work in my other levels?
THANKS MA DUDE
thanks brackeys for these teaching lessons i'm 12 years old and i make a game but i only have to do is to name it and make an icon and make some more levels and add audio thanks so much
What about if i want to pause with a button?
REMEMBER! If you want your Update() functions not getting your inputs, write
if (PauseMenu.GameIsPaused) return;
at the beginning of your Update(). Instead it will be getting them. And using FixedUpdate for your input system is a bad idea from my programming experience
As you know main menu shown before game screen. So menu screen loaded before game screen. Is there any way to show previous loaded screen? In this tutorial, menu screen is loaded over again everytime.
I need help please Im on a fps game I can't click or interact whith the buttons
For some reason, the buttons don't change color on hovering and don't do the click events
after i press menu and then play again it wont work anymore the pause menu
Thanks Brackeys u so awesome and always have good tutorials 🙂
When I press the button to pause the game I still can look around and shoot. Can you help me?
Wait, whats the point of the Resume button if u can just press escape to resume the game
using UnityEngine.UI;
is what you have to enter if your having troubles
ok i just wanna say
FUCK THIS LINE Cursor.lockState = CursorLockMode.Locked;
2 hours…
My menu still stops, what should I do?
i typed :
public GameObject PauseMenuUI;
however when i went back into unity there was no other box in my script component.
and yes.
i did save it.
edit: nm fixed.
Editing out all the pauses for breath makes this intensely exhausting to follow. Take a breath mate!
After I go back to main menu from the Pause menu clicking Menu button. The game doesnt start again even after clicking play button. I have to start again to play from main scene.
Can anyone help me out how can I continue to play after I go back to main menu from PauseMenu scene???
how to hide the cursor and also be able to click the buttons over there??
i tried this but it doesnt work along witht the button click
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Cursorhide : MonoBehaviour {
void Start () {
Cursor.visible = true ;
Cursor.lockState = CursorLockMode.Locked;
}
}
I ran into an issue where once I click on the menu, it sends me to the menu which is perfect however, I can't click on anything anymore on my menu 🙁 does anyone know how to fix this. Thanks <3
I dont have Pausemenuui
I forgot to make pause button. lol Earlier tonight I tried to make one and I did literally everything in this video without watching it beforehand, but I tried to implement animations and that was super tricky because I had a few hoops to jump through. In the end, I had a pause menu with an animation that was quirky but worked, and I know people wouldn't like it because it's quirky and would disrupt the player from immersing themselves in the game. I want a fancy pause menu with an animation instead of just enabling a UI, that's boring. Can someone please let me know if that's possible with Time.timeScale or if there's some other method? Maybe I'm missing something? lol
Edit: Just some extra info, I used Coroutines and not void functions like the guy in the video. I called the couroutine called Pause() and Unpuase() to handle the pause stuff. I have an animator variable and some other things for text. But just a little fyi in case someone has some light to shed on my information. =)
spent two hours on this problem and you fixed it in the first 40 seconds
i have a menu popup animation, the problem is, that when i pause the game by timescale = 0, then my Animation won't show up…
if anyone runs into the problem of the game starting paused after it didn't for brackeys just go into the inspector on the pause menu item and set it to unactive, after that it should work fine
Has anyone created a variable for their scenes / levels? How would you code it?
Thank you, you save me a lot of time.
The pitch of my background audio doesn't decrease when paused, can anyone help me out ???