Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 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 /
avatar image
1
Question by esandez93 · Jan 29, 2015 at 05:37 PM · c#buttonmenupauseunity4.6

Unable to click UI Button (Unity 4.6) when TimeScale is 0

I'm developing a game and I'm currently creating the pause menu. Whenever I press the key for pause the game (p in my case) it stops just as I want setting Time.timeScale to 0. After it I want to show the buttons for resuming the game, go back to main menu, quit it, etc. but then I'm unable to click them.

I have some testing only buttons using the old GUI features and they still work when the game is paused but I can't click the Unity 4.6 UI buttons.

Comment
Add comment · Show 3
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 troien · Jan 29, 2015 at 05:48 PM 0
Share

When I test this, Unity UI buttons work, even when Time.timeScale is 0.

Are you sure it's not some animations that are not playing?

If so, go to your Animator component and in the inspector and change the 'Update $$anonymous$$ode' to 'Unscaled Time'...

avatar image meat5000 ♦ · Jan 29, 2015 at 05:53 PM 0
Share

Does you code rely on update for that functionality?

avatar image esandez93 · Jan 29, 2015 at 06:27 PM 0
Share

For a better explanation, I have a Button with a disabled $$anonymous$$i script attached. This script is only this:

 public class ResumeGame : $$anonymous$$onoBehaviour{
 
     void Start (){
         Gamestate.instance.gameObject.GetComponent<Pause>().unpause();
 
         this.enabled = false;
     }
 }

In the same button's OnClick() function I enable this script, so when I click the button it should enable this script, resume the game and then disable it.

The problem comes when I can't click it. I've done this method in the main menu and it works, so the only thing co$$anonymous$$g to my $$anonymous$$d is the timeScale set to 0.

1 Reply

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

Answer by esandez93 · Jan 30, 2015 at 03:38 AM

I've found the solution! The Button is attached to a Canvas that is attached to a GameObject that DontDestroyOnLoad(). But this 4.6 Unity UI needs an EventSystem GameObject which is created when you create the Canvas, but as my Canvas was created in a previous scene, in my current scene (where I wanted to click the Button) I wasn't able to click it.

Tl;dr: If you have an UI Button you need an EventSystem in the scene.

I hope someone find it useful!

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 M0rrigan · Sep 25, 2015 at 08:10 AM 0
Share

Thank you very much for posting your reply! It's the only resource that allow me to fix this bug! Thank you again!!!

avatar image Rebaken-Enterprises · Nov 01, 2019 at 11:43 PM 0
Share

Bingo! Same in Unity 2018 :D

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

6 People are following this question.

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

Related Questions

UI 4.6 menu "Start" button script c# 0 Answers

Pause Menu Not Pausing 3 Answers

How to implement Clicking in Unity-GearVR by pointing Light??? 1 Answer

Change the position of a UI component through pressing a UI Button 1 Answer

Bool wont change... #C 1 Answer


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