Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by dennisfomichevf65 · Jun 27, 2018 at 08:52 PM · pause menu

When Game Is Paused, Camara Can Still Move Around.

So basically I followed a youtube tutorial to do my pause menu. But when I pause my game I can still move my camera around. Can someone help me, please? This is my code: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement;

public class PauseMenu : MonoBehaviour {

 public static bool GameIsPaused = false;

 public GameObject pauseMenuUI;

 // Update is called once per frame
 void Update () {
     if (Input.GetKeyDown(KeyCode.Escape)) 
     {
         if (GameIsPaused) 
         {
             Resume();
         } else 
         {
             Pause();
         }
     }
 }

 public void Resume () 
 {
     Debug.Log("Resume Is Working");
     pauseMenuUI.SetActive(false);
     Time.timeScale = 1f;
     GameIsPaused = false;
 }

 void Pause () 
 {
     Debug.Log("Pause Is Working");
     pauseMenuUI.SetActive(true);
     Time.timeScale = 0f;
     GameIsPaused = true;
 }

 public void LoadMenu() 
 {
     Debug.Log("Load Is Working");
     Time.timeScale = 1f;
     SceneManager.LoadScene("Menu V3");
 }

 public void QuitGame() 
 {
     Debug.Log("Quitting game...");
     Application.Quit();
 }

}

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image LeeJBaxter · Jun 28, 2018 at 01:07 PM 0
Share

Please could you post the rest of the code, as this only provides half of the picture. It looks as though this code is correct, so the problem more-than-likely lies in your camera control code. Your camera control code should be reading the "GameIsPaused" variable in order to deter$$anonymous$$e whether to enable or disable the controls. By the way, is there any reason why this variable is static (this could potentially introduce bugs, as multiple instances would be sharing their state).

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by dennisfomichevf65 · Jun 28, 2018 at 02:39 PM

@LeeJBaxter What do you mean the rest of the code? This was all the code that is for my pause menu. Also I do not have any camera control code. Do I need to make it? Also there is no reason why the variable is static. I just followed the tutorial that said to do static.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image LeeJBaxter · Jun 28, 2018 at 03:23 PM 0
Share

Sorry for the confusion! I mean the script that controls the movement of your camera. I'm guessing this script will probably be attached to the Camera. If I'm correct, that script will check the "GameIsPaused" variable to decide whether it should be allowed to move or not.

avatar image dennisfomichevf65 · Jun 28, 2018 at 03:30 PM 0
Share

@LeeJBaxter Well, see I deleted the camera because I have the first person controller that I got from one the unity packages that does not come with a script for the first person controller. $$anonymous$$aybe it did but i didn't enable it.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

146 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

when i pause a game using UI panel and freezing time, my falling coins in the level is still showing. 1 Answer

Pause Menu Problems 1 Answer

Pausing a game 2 Answers

Survival Shooter problems 0 Answers

When I Go To Main Menu From Pause Menu, My Menu Freezes. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges