• 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
2
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, w$$anonymous$$ch 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)... everyt$$anonymous$$ng works in hub AND level 1 and 2...

However, when loading level 3 w$$anonymous$$ch 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 not$$anonymous$$ng 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 not$$anonymous$$ng changed) menu works in hub and in stage 1 and 2 but not in 3rd one...

THANKS to anyone who read t$$anonymous$$s 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
12
Best Answer

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

After more than 36 hours of t$$anonymous$$nking about not$$anonymous$$ng else... Trying everyt$$anonymous$$ng 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 somet$$anonymous$$ng that "appeared" in them somehow... (I write it t$$anonymous$$s 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 w$$anonymous$$ch had not a single answer like t$$anonymous$$s 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 searc$$anonymous$$ng 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 coming 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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

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

OnTrigger - playing sound once with delay 2 Answers

How can I start a Coroutine with the onClick of a button? 0 Answers

[C#] Coroutine just won't stop! 2 Answers

Advice on debugging a blocked main thread only on iOS 0 Answers

When I open my Ingame Menu My mouse appears Then when I click it disappears 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