How to pause Unity game | Simple Unity 2D tutorial



#UnityTutorial #SimpleUnityGame #unitypausegame #unitypause
In this video I will show how you can add a pause function to your Unity game. We create a UI button and make a script which will be attached to this button. When you click or push this button your game stops until you push pause button again. Very simple solution. We use Time.timeScale=0 to stop game running and Time.timeScale=1 to run a game.

The BEST MECHANICAL KEYBOARD Metoo Zero for the price. I use it. And I must say that it’s perfect!

Consider purchasing my ULTIMATE UDEMY COURSE with great discount

www.vecteezy.com – best free vector graphics library ever!

What this video is about and what it can be used for also: unity 2d tutorial,
How to pause Unity game, how to pause, how to pause unity, pause game unity, pause button unity, stop game unity, how to stop game running unity, pause function unity, game paused unity, how can I pause unity game, unity pause, unity pause game, pause, Time.timeScale=0, Time.timeScale=1, pause UI button unity, pause button unity, pause button, learn unity fast, unity tutorial, how to make games with unity, unity how to make game, unity how to make 2d game, not as good as brackeys but good as well.

Nguồn: https://khosimphongthuy.net/

Xem thêm bài viết khác: https://khosimphongthuy.net/game/

All Comments

  • Grazie! funziona!

    Nausica Minni July 25, 2020 7:49 pm Reply
  • Script

    using System.Collections;

    using System.Collections.Generic;

    using UnityEngine;

    public class PauseScript : MonoBehaviour {

    bool isPaused = false;

    public void pauseGame()

    {

    if (isPaused) {

    Time.timeScale = 1;

    isPaused = false;

    } else {

    Time.timeScale = 0;

    isPaused = true;

    }

    }

    }

    MTGK - Meraklı TV July 25, 2020 7:49 pm Reply
  • thank you

    farida khal July 25, 2020 7:49 pm Reply
  • Im to lazy to copy the code word by word, can someone leave a reply so i can ctrl c ctrl v?

    Taldoesgarbage July 25, 2020 7:49 pm Reply
  • What does time.timescale=0 actually affect? Is it literally everything in the game stops mid-move? Rigidbodies, UI elements, animation, etc?

    C B July 25, 2020 7:49 pm Reply
  • Thanks dude helped so much 👌🏻

    Broco8 July 25, 2020 7:49 pm Reply
  • thanks m8 🙂

    Teuz1 July 25, 2020 7:49 pm Reply
  • Haha I'm again here :)) another great simple solution.

    Marcin July 25, 2020 7:49 pm Reply
  • greatttttttttttttttttt

    Ahoura Kamangarpour July 25, 2020 7:49 pm Reply
  • SWEETTT!!!

    Inacio Nunes July 25, 2020 7:49 pm Reply
  • Thank you! :3

    Lucas Lima July 25, 2020 7:49 pm Reply
  • Do a video on how much you earn from games

    Shelbert Miller July 25, 2020 7:49 pm Reply
  • Intense music, yellow on green text elements, is this the perfect tutorial? Lol

    monsieur délire July 25, 2020 7:49 pm Reply
  • I love easy solutions, thanks for this.

    Jared July 25, 2020 7:49 pm Reply
  • great video i subbed
    i am a small youtuber here btw

    oximas July 25, 2020 7:49 pm Reply
  • that's quick and cool.. thanks

    Asm Kawsar July 25, 2020 7:49 pm Reply
  • Спасибо за урок, мне очень помогло!

    Honor and Glory July 25, 2020 7:49 pm Reply
  • Like always, it worked as spected!!
    Thanks a lot!

    Federico Arrico July 25, 2020 7:49 pm Reply
  • THASNK U SOO MUCH I hope I can be good like u one day I subbed

    Daniel Eccleston July 25, 2020 7:49 pm Reply
  • This doesn't really work as I thought: My enemy characters stop moving and their animations are paused but I can still hear the sounds of them firing every now and then; my gun still fires and the bullet shells eject (which I actually still want to happen when the game is paused) but the shells are instantly just floating still in midair; if I shoot at enemies they still play their impact animations even though the game is paused; etc. The game basically isn't really paused much at all it seems to me.
    Also what about stuff I don't want to pause that might automatically be paused using this method: How do I stop that stuff pausing automatically here?

    inceptional July 25, 2020 7:49 pm Reply
  • I'm making a Kinect game using Unity.
    I created a pause function while playing the game and stopped using Time.timeScale = 0 when the menu Canvas was opened using the button UI.
    However, after connecting the Kinect menu Canvas is up, but Time.timeScale = 0 function is gone.
    Why? Are timescale ignored while connecting? There is no way ???

    김제영 July 25, 2020 7:49 pm Reply
  • Should vsync be on for a game on android? And should i set target frame rate??

    N.A ClaSHer yt July 25, 2020 7:49 pm Reply

Leave a Reply

Your email address will not be published. Required fields are marked *