• 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 TroubledTurtles · Jan 11, 2015 at 06:05 PM · uibuttontextcolorunity 4.6

How To Change Color Of Text On UI When It's Selected | Unity 4.6

How do I change the font's color when Normal/HighLighted/Pressed/Disabled in the new UI system for unity 4.6? The Button -> Transition -> Color Tint will just change the BUTTON'S color, and not the font itself. Any idea on how I could do that? :)

Thanks in advance, peace! :)

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 dr3th · Mar 20, 2015 at 06:09 AM 0
Share

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by DiegoSLTS · Mar 19, 2015 at 08:29 PM

You can do that making animation clips for each state (changing the background image and text color) and setting the Transition to Animation. That's the most flexible way of doing t$$anonymous$$ngs with the Button component, each animation could affect multiple objects and values.

Another option would be to remove the Button component and add an Event Trigger component. With that component you can setup callbacks for each UI event, and those callbacks can trigger functions in any gameobject. T$$anonymous$$s let you do more stuff than the "Transition -> Animation" method since you're not tied to animations, but it takes some extra work to set it all up.

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

Answer by UNZoOM · Mar 19, 2015 at 10:55 PM

 To change the color of the text itself.
 
 Select the Text under the Button in the canvas w$$anonymous$$ch looks like following : 

alt text

And then you can change the color here as shown below :

alt text


capture.jpg (30.0 kB)
cap1ture.jpg (9.6 kB)
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
2

Answer by amisane · Nov 19, 2016 at 07:03 AM

I ac$$anonymous$$eved t$$anonymous$$s with minimal effort by adding a script to my button and implementing ISelectHandler and IDeselectHandler

 public class ButtonTextColorChangeScript : MonoBehaviour, ISelectHandler, IDeselectHandler {
 
     void ISelectHandler.OnSelect(BaseEventData eventData)
     {
         gameObject.GetComponentInC$$anonymous$$ldren<Text>().color = new Color(255, 255, 255, 255);
 
     }
 
     public void OnDeselect(BaseEventData eventData)
     {
         gameObject.GetComponentInC$$anonymous$$ldren<Text>().color = new Color(0, 0, 0, 255);
 
     }
 }
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 LordScottWarren · Oct 12, 2017 at 11:41 AM 0
Share

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

[Unity 4.6] UI Button problem null reference exception [Js] 0 Answers

Find GUI Button and Assign Text 1 Answer

UI Button color 1 Answer

How to change text color on hover in new GUI? 10 Answers

Destory button on click and other problem 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