Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 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 /
avatar image
9
Question by andrewwebber25 · Jun 14, 2017 at 08:12 PM · buttonbuttonscolor changepause menupause game

Buttons will not change color

Hey guys so Im trying to make a Pause Menu in Unity with Buttons that change color when highlighted or pressed. Right click Canvas, UI, Button and in inspector view I change the colors for "Normal Color", "Highlighted Color" and "Pressed Color". Normal Color changes instantly but when I press play, the Highlighted and Pressed colors dont seem to work when I hover over the buttons or click them with the mouse.

Ive watched two tutorials on how to make the menu and they just quickly select the color and it works no problem. Any reason why it isnt working for some people? Using version 5.6.0f3

Comment
Add comment · Show 6
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 Vicarian · Jun 14, 2017 at 08:25 PM 0
Share

Do you have an EventSystem component in your scene? If this is missing, then I don't think the color transitions will work. Another point of failure is not having an image associated with your Button. Yet still could be that for some reason Color Tint isn't the type of Transition selected for the button. Finally, the alpha channel of the color might be set fully transparent. Could you post a screen grab of your Hierarchy and Inspector with the button selected?

avatar image andrewwebber25 Vicarian · Jun 14, 2017 at 09:01 PM 0
Share

Here is a Snippet

So I do have EventSystem which automatically comes with Canvas. I Dont have any image associated with my Button but I dont think Ive ever seen anyone do that because I would use something like Sprite Swap or Animation then ins$$anonymous$$d of Color Tint that is there by default. I have the game in Play mode in the pic, youll have to take my word for it when I say the buttons dont do anything when I hover or click them.

I did another tutorial that is just making a pause button (no color affects) and adding simple code to it to pause the game. I have no error codes at all when I attach it. I press the P key, the pause menu comes up but when I press the pause button I made, nothing happens again. Its almost as if buttons are not working for me in any way, whether they have code or if im just trying to change the color! Thank you so much for replying, I really appreciate you helping me!

capture.jpg (139.5 kB)
avatar image Vicarian Vicarian · Jun 15, 2017 at 09:02 PM 0
Share

The only way I was able to reproduce the behavior you described is if the game window did not have focus. In development, focus is lost easily if you're making changes via the inspector. Does it still behave this way after you click back into the Game Window and then attempt mousing over or clicking the buttons?

avatar image eskivor · Jun 15, 2017 at 07:39 AM 0
Share

Is there an Event Sytem on your scene, are its scripts active ? Is your button script active, is its parameter "interactable" active ?

avatar image andrewwebber25 eskivor · Jun 15, 2017 at 12:16 PM 0
Share

I think so. If you look in my hierarchy, you can see EventSystem (this automatically came up when I created the canvas). How would I know if the EventSystem and Button scripts are active? Do you mean is the checkbox checked beside them? Cause it is by default. I feel like you can see all that in the image I posted.

avatar image SohailBukhari · Jun 16, 2017 at 06:16 AM 0
Share

Some of the image is over resume button and its may be text or simple panel and its raycast target is enabled and it blocking your resume button otherwise your i didn't see anything wrong in setting up hierarchy.

11 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by awaismazhar999 · Jun 15, 2017 at 11:30 AM

Dear @username

  1. Make sure that the Transition of Button component is set to Color tint.

  2. Make sure that Intractable property of your button property is checked.

  3. Make sure that Event system property is present in your Hierarchy.

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 andrewwebber25 · Jun 15, 2017 at 12:20 PM 2
Share

Did you see my image? You can obviously see all those things are present.

avatar image
1

Answer by Hoorza · Nov 19, 2018 at 12:22 AM

The same problem occurs with 2018.2. Sucks. My quick workaround to make the 'Normal' color to come back after the button has been released:

In my function that is called when the button is depressed, I disable and then right after I enable 'Button' component.

 exampleButton.enabled = false;
 exampleButton.enabled = true;

Not visible to the viewer and it brings the normal color back. I know it is not the right way but it is quick and easy fix. So far I have not had any issues with this approach.

P.S. I use 'Event Trigger (Script)' and 'PointerUp' Event Type to call some functions when the button is being released. That is where I have put my reset code.

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 StarKen · Jan 19, 2020 at 05:33 AM

Watch this video and please follow the steps in detail.

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 unity_KM_cLG0O8_9Igw · Feb 11, 2021 at 06:38 PM 0
Share

ok. just found out that my image color should be transparent like 140 and button color to your preferences.

easy to get confused when you set your image color to black.

avatar image
0

Answer by wspnut · Mar 06, 2018 at 08:05 PM

I'm having the same problem - my settings are as listed, too. Did you ever find a resolution?,I'm having the same problem; all of my settings are checked as well - very odd.

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 wspnut · Mar 06, 2018 at 08:10 PM 1
Share

To answer my own question (of course I figure this out right after I post - rubber duck debugging at work), in case anyone else needs help:

I had removed the default Inputs from the Project Settings. I was getting an Error until I re-added the Submit and Cancel Input options (unused). Once that was fixed, the highlighting worked as expected.

I personally don't see the rationale behind it, and it feels like a bug or oversight in the implementation of the EventSystem.

avatar image
0

Answer by breaddy · Mar 28, 2018 at 03:21 AM

I had the same problem and debugged it somehow lol. The reason my button is not being highlighted is that I have an image with a transparent background that is covering my button's ray case. So I go to my image and disable the "Raycast Target" option. :) Fixed

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
  • 1
  • 2
  • 3
  • ›

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

89 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

Related Questions

Pause menu not working 1 Answer

Game stays paused after Restart. 1 Answer

Pause Game Through Button UI Click Instead of Escape Key? 2 Answers

PS4 MENU not functioning 0 Answers

How to Disable Boxcollider2d when game is paused. 2 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