How To Pause Your Game: The Easy (And Right!) Way--Unity 2D Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ต.ค. 2024

ความคิดเห็น • 26

  • @ivkuben4022
    @ivkuben4022 ปีที่แล้ว +4

    You seriously have some of the best tutorials on youtube, thanks for making these :)

    • @NightRunStudio
      @NightRunStudio  ปีที่แล้ว

      Thanks for sharing! So glad the vids are helpful to people.

    • @NightRunStudio
      @NightRunStudio  9 หลายเดือนก่อน

      @@majorfur3999 Thanks for taking the time share! It's always great to read comments like this.

  • @minbub1389
    @minbub1389 3 หลายเดือนก่อน

    hey.. did you uploade it on github or somewhere else

  • @maximilianherzen3105
    @maximilianherzen3105 ปีที่แล้ว +1

    Very cool tutorial series! It has really helped me with my game so far. I'm only currently getting the error message "ArgumentException: Input Button Cancel is not setup". I also see the pause menu being disabeld and enabeld again, but my menu doesn't pop up. Does anyone know why this is happening?
    I don't usually write comments, but people seem to be very chilled here xD.

    • @NightRunStudio
      @NightRunStudio  ปีที่แล้ว +1

      That error has to do with your InputManager. If you go to Edit-->ProjectSetting-->InputManager you need to make sure that there is a button for Cancel (usually it is there by default in a new project). You can then select which button will be used for Cancel.
      I suspect the menu not popping up probably stems from you not having a Cancel button set up as well. But if not, feel free to post another question. Cheers!

    • @maximilianherzen3105
      @maximilianherzen3105 ปีที่แล้ว

      Everything worked out! Thanks for the quick feedback. You really have a great TH-cam channel! @@NightRunStudio

  • @Piece4Peace911
    @Piece4Peace911 6 หลายเดือนก่อน

    I used this pause script for your 2D scroller tutorial, but every time that I run the game, the pause menu is on the screen, but I can still move normally. If I click Esc twice, then the pause menu disappears and it'll reappear and function normally any time I press Esc afterwards. Why might this be happening?
    Many thanks in advance!

    • @Piece4Peace911
      @Piece4Peace911 6 หลายเดือนก่อน

      I fixed it, I just made a small mistake following your steps. tysm

    • @NightRunStudio
      @NightRunStudio  6 หลายเดือนก่อน

      I was puzzling over an answer for you... then I saw your follow-up. Haha. Glad you figured it out!@@Piece4Peace911

  • @MintberryCrunch7
    @MintberryCrunch7 8 หลายเดือนก่อน

    Why use public variables when you could instead use private variables with a [SerializeField] ?

    • @NightRunStudio
      @NightRunStudio  8 หลายเดือนก่อน +1

      It really depends on audience. The fact that you are asking that question probably means that serializefield is the best option. That said, I prefer not to introduce that concept in more beginner-friendly videos. There’s so much to learn when you’re new, and in a small project public variables are pretty safe.

    • @MintberryCrunch7
      @MintberryCrunch7 8 หลายเดือนก่อน +1

      @@NightRunStudio Okay thanks for the explanation, I wasn't sure if there was a specific reason but it sounds like it was more to reduce complexity at this stage.

  • @kulaos8340
    @kulaos8340 ปีที่แล้ว +1

    I used this for your 2D side scroller guide and while the game pauses, my character can side move his body left and right. There's no movement, however his body still switches around.

    • @NightRunStudio
      @NightRunStudio  ปีที่แล้ว +1

      This method pauses the game by freezing everything related to time in Unity. This includes fixed update but not update. If your flipping is still working, I suspect it’s because you call the flip from within update. You can disable this if you move that code into fixed update. I hope that helps!

    • @kulaos8340
      @kulaos8340 ปีที่แล้ว +1

      @@NightRunStudio It worked! thanks, you're a genius lol.
      Is there a possibility, you can make an equipment enhancement tutorial? For example, making your gears with stats go from +1 to +2 and increasing it's stats.

    • @NightRunStudio
      @NightRunStudio  ปีที่แล้ว +1

      Thanks for the suggestion! Do you just mean something simple so that, say, when you talk to an NPC (like a shopkeeper) your stats go up? Or something fancier including a whole equipment system and UI display?

    • @kulaos8340
      @kulaos8340 ปีที่แล้ว +1

      @@NightRunStudio Something fancier including a whole equipment system and UI display. To upgrade the item it would cost some kind of material or gold.

    • @NightRunStudio
      @NightRunStudio  ปีที่แล้ว

      @@kulaos8340 Have you already checked out my inventory and equipment system tutorial series? These would certainly get you off to a good start. That said, adding a shop system that connects up to this is something I will look into before long. Maybe that will be my next series after the dialogue series I just started. Thanks again for the ideas!

  • @Slappy-Chappy
    @Slappy-Chappy ปีที่แล้ว

    Hi again!
    I was adding this to my game and it was all working great, I even added the functionality for it to pause the background music. However, I wanted to add a button to this panel that would load the Main Menu Scene, by adding a method called "LoadMenu()" to the PauseMenu script, which simply contains the code:
    "Scenemanager.LoadScene("Main_Menu");"
    I then added a Legacy button to the panel that is set to run that method when clicked (it has the On Click(), Runtime Only, and then I dragged in the Canvas object, and then set it to PauseMenu.LoadMenu so that it'll run that method).
    However, when I play the game, pause the game, and then click the button on the pause panel, nothing happens and I am not quite sure why.
    Would it be that the game is not registering my input because Time.timescale is set to 0? Or could it be that because my shoot keybind is left click, which I am trying to use to click the button, there is some overlaps that cause this problem? Otherwise I am not sure.
    Any help is appreciated!

    • @Slappy-Chappy
      @Slappy-Chappy ปีที่แล้ว

      Nevermind! It turns out that I had it all correct, but I made a syntax error when I wrote "Scenemanager.LoadScene("Main_Menu");", as it SHOULD'VE been:
      "Scenemanager.LoadScene("Main Menu");"

    • @NightRunStudio
      @NightRunStudio  ปีที่แล้ว

      Haha! So glad you figured it out. Thanks for sharing your solution for others who might try the same thing!

  • @ArtieIntel
    @ArtieIntel 4 หลายเดือนก่อน

    Hi, I'm making my own game using Unity and I've been following your tutorial and everything is going smoothly so far. But (sorry this may be silly question) what is the type of object you're making that pause menu canvas? Is it a 2D object or is it an empty object? It's like I skipped some video or something. Thanks in advance :D

    • @ArtieIntel
      @ArtieIntel 4 หลายเดือนก่อน +1

      It's okay I've found it. Silly me

    • @NightRunStudio
      @NightRunStudio  4 หลายเดือนก่อน +1

      @@ArtieIntel Glad you figured it out! Good luck with your project.