• 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
0
Question by MahaSaka · Nov 26, 2018 at 02:20 AM · buttoncanvasuser interfacepause menutime.timescale

Use UI buttons with Time.timeScale=0?

I'm creating a pause menu (which sets Time.timeScale to 0) and none of my buttons work. I've already tried using an animator with unscaled time (in the canvas and then in the buttons individually). What am i doing wrong? There is a event system in the scene and every button has it respective On Click function set (With a Debug.Log just in case). How can I use UI buttons with Time.timeScale = 0? Or, is it a better way to pause my game?

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 Vega4Life · Nov 26, 2018 at 03:48 PM 0
Share

I think we need to see code at this point. Changing timescale to zero doesn't affect the usage of buttons, thus maybe you are disabling the canvas or some other code-fu you are doing?


You can test this by creating a new scene. Adding a UI button. Creating a small script with an onClick() method for changing the timescale from 0 to 1 (add some debug logs), then apply it to the button. You will see it change the time scale back an forth.

3 Replies

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

Answer by MahaSaka · Nov 26, 2018 at 03:44 PM

I found my answer here: https://answers.unity.com/questions/1148727/ui-button-not-working-2.html . It turns out that my panel was higher in the hierarchy than my buttons, making it draw above them. That's why the buttons were blocked.

Comment
Add comment · 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
1

Answer by game4444 · Nov 26, 2018 at 09:23 AM

It works perfectly fine. In Time.timeScale = 0; because you cant resume your game in case if it didn't work. Please check your canvas or panel which you are enabling on pause Button and check whether your buttons are on top of panel.

Comment
Add comment · Show 1 · 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 MahaSaka · Nov 26, 2018 at 03:30 PM 0
Share

I still don't know what to do. I checked the canvas and nothing seems off. I't has a graphic raycaster and every button is inside of it.

avatar image
0

Answer by sundhar_unity · Aug 27, 2020 at 06:10 AM

https://youtu.be/O_fzjRZWh34

Comment
Add comment · 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

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

121 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

Related Questions

Hidden Canvas, doesn't disable interaction with buttons. 1 Answer

Augmented reality - UI - How do I augment an User Interface Canvas properly? 0 Answers

Why i can't see methods inside a script that directly dragged to the Onclick area inside the button and see them dragging canvas with that script inside it?, 1 Answer

Button doesnt work after reactivating Canvas. 4 Answers

Can someone please convert this to C#?Actually I tried but its not working properly.I dont actually want pause menu.I just want to show a canvas after a collision in game. 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges