Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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
1
Question by FireHawkX · Apr 26, 2016 at 03:54 PM · c#coroutinebuttonspause menunot responding

C# Pause Menu Buttons not working in only 1 scene

Hi all, "semi new" to Unity and C#... let me just say that I went through about 60 different answer pages to try and find an answer before writing here! I also searched all over google for hours! (not kidding)

I have a very basic pause menu that I load in my 1st scene, which brings me immediately to my "hub scene", from there the menu works perfectly... i can load level 1 and 2 with no problems and the menu keep working as intented (I can change volume, go back to hub, quit application or resume)... everything works in hub AND level 1 and 2...

However, when loading level 3 which is a 2d space shooter (see unity tutorial space shooter as its very similar), the menu BUTTONS stops working... I can press ESC to open it... audio gets "dimmed"... mouse appears... I can close the menu again with ESC and game resumes perfectly... however none of the buttons on the menu works! Audio slider doesnt respond... and neither does any of the 3 buttons (quit, resume, return hub)... My "GUESS" is that since that scene has 1 coroutine with some yield and wait for second that could block the menu... i tried pretty much breaking that scene and removing as much as i could but nothing worked... menu doesnt want to work in that 1 scene...

Here is the full code from my pause menu (however i have re-written it 3 times with different syntax and sub functions and nothing changed) menu works in hub and in stage 1 and 2 but not in 3rd one...

THANKS to anyone who read this and many more thanks if you can help me out! :)

 using UnityEngine;
 using System.Collections;
 using UnityEngine.SceneManagement;
 using UnityStandardAssets.CrossPlatformInput;
 using UnityStandardAssets.Utility;
 using UnityEngine.UI;
 using UnityEngine.Audio;
 #if UNITY_EDITOR
 using UnityEditor;
 #endif
 
 namespace UnityStandardAssets.Characters.FirstPerson
 {
     [RequireComponent(typeof (CharacterController))]
 
 public class PauseManager : MonoBehaviour {
     
     public AudioMixerSnapshot paused;
     public AudioMixerSnapshot unpaused;
     [SerializeField] private MouseLook m_MouseLook;
     Canvas canvas;
 
     void Start()
     {
         SceneManager.LoadScene("HugoArcade");
         canvas = GetComponent<Canvas>();
         canvas.enabled = !canvas.enabled;
     }
     
     void Update ()
         {
             if (Input.GetKeyDown (KeyCode.Escape) && Time.timeScale == 1)
             {
                 canvas.enabled = true;
                 m_MouseLook.SetCursorLock(false);
                 paused.TransitionTo(.01f);
                 Time.timeScale = 0;
             }
             else if (Input.GetKeyDown (KeyCode.Escape) && Time.timeScale == 0)
             {
                 canvas.enabled = false;
                 m_MouseLook.SetCursorLock (true);
                 unpaused.TransitionTo(.01f);
                 Time.timeScale = 1;
             }
     }
     
     public void Quit()
     {
         Time.timeScale = 1;
         #if UNITY_EDITOR 
         EditorApplication.isPlaying = false;
         #else 
         Application.Quit();
         #endif
     }
 
     public void RTArcade ()
     {
         Time.timeScale = 1;
         SceneManager.LoadScene("HugoArcade");
         canvas.enabled = false;
         m_MouseLook.SetCursorLock(true);
         unpaused.TransitionTo(.01f);
     }
 
     public void ResumeGame ()
         {
             canvas.enabled = false;
             m_MouseLook.SetCursorLock (true);
             unpaused.TransitionTo (.01f);
             Time.timeScale = 1;
         }
     }
 }
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 FireHawkX · Apr 26, 2016 at 04:57 PM 0
Share

Add-on :

I dont get it... I tried making a backup of my scene (the one where the menu doesnt work properly) and then I started deleting stuff... to try and find out where it was freezing...

I deleted the whole gamecontroller gameobject... didnt change anything... deleted and remade camera... deleted the player and playercontroller script altogether...

eventually i deleted EVERY SINGLE THING in the scene... made a single new camera with black background... and tried it... same bug!!! menu works (open and closes with ESC key) but i cannot interact with it in any way...

I've been on this for about 20h in the last 3 days... this is crazy...

1 Reply

· Add your reply
  • Sort: 
avatar image
11
Best Answer

Answer by FireHawkX · Apr 27, 2016 at 01:18 AM

After more than 36 hours of thinking about nothing else... Trying everything Including deleting every single assets from my scene (AFTER making a backup of course)... I finally found out the answer!!

All the other scenes had something that "appeared" in them somehow... (I write it this way because in all 14 unity tutorials I never once added that myself)...

EventSystem... it seems that the pause menu will only work if there is an event system present in the scene!!

I remember seeing 2 or 3 posts about buttons not responding in pause menu... all of which had not a single answer like this one... I still do not understand why it was bugging out the way it was... but at least now i know how to make it work!!

Hopefully it might help someone out one day searching for a similar issues :)

Comment
Add comment · Show 9 · 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 eiglimar · Oct 19, 2016 at 12:09 PM 0
Share

Thx man it works for me too!

avatar image dbeezt · May 16, 2017 at 01:22 PM 0
Share

Thank you so much for co$$anonymous$$g back to answer yourself!

avatar image JUllrich · Apr 01, 2018 at 01:39 PM 0
Share

Facepalm after reading your answer. Thank you.

avatar image jd_alvarezparra · May 08, 2018 at 06:29 PM 0
Share

Thanks man!!

avatar image abssuper20 · Jul 19, 2018 at 02:55 AM 0
Share

Thanks man. It worked!! Can't believe i missed out something that small but important :P

Show more comments

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

163 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 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

C# Disabling Camera moving while in Pause Menu 1 Answer

Cascading dropdown menus 0 Answers

Update() function keeps running AFTER script is disabled... 1 Answer

IEnumerator instead of LateUpdate in unity 1 Answer

Help with pause menu? 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