Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by jtbentley · Nov 18, 2010 at 05:14 AM · editortextcolor

Changing font colour

I have 3 imported fonts in my project, the 'Text Color' button & color picker are ghosted, and do not work.

Is this a bug? I have attempted to re-import the fonts, but the option is still ghosted. I have also imported other fonts. Any ideas?

alt text

Ghosted!?

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 Proclyon · Nov 18, 2010 at 08:08 AM 0
Share

Well it may help to check if another computer / version etc. has the same problem with this font. That will get you the answer of WHERE the problem is pretty quickly. Usually it's not Unity3D being the problem. $$anonymous$$y rule of thumb is to never blame the computer because you just end up being wrong all the time :)

6 Replies

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

Answer by zoon · Nov 18, 2010 at 05:54 AM

Definitely, not intuitive:

http://unity3d.com/support/documentation/Components/class-Font.html

Changing Font Color

There are different ways to change the color of your displayed font, depending on how the font is used.

GUIText & Text Mesh If you are using a GUIText or a Text Mesh, you can change its color by using a custom Material for the font. In the Project View, click on Create->Material, and select and set up the newly created Material in the Inspector. Make sure you assign the texture from the font asset to the material. If you use the built-in GUI/Text Shader shader for the font material, you can choose the color in the Text Color property of the material.

UnityGUI If you are using UnityGUI scripting to display your font, you have much more control over the font's color under different circumstances. To change the font's color, you create a GUISkin from Assets->Create->GUI Skin, and define the color for the specific control state, e.g. Label->Normal->Text Color. For more details, please read the GUI Skin page.

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 jtbentley · Nov 18, 2010 at 10:43 PM 0
Share

Okay so this is quite a step backward in terms of practicality since Unity iPhone 1.7 :) But if it works, it'll do.

avatar image Craig Farrell · Jun 04, 2011 at 02:02 AM 0
Share

Is this still valid? How do you associate the new $$anonymous$$aterial to the font?

avatar image
1

Answer by jonas-echterhoff · Nov 18, 2010 at 10:41 AM

As zoon pointed out, you need to create your own custom font material and use that.

The reason is that we don't allow editing of imported assets, only of the import settings - otherwise, this would be a sure way of breaking things when using external version control. However, having an option for font color in the font importer seems like a very reasonable request, though.

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 Crys · Jun 05, 2011 at 01:28 PM 0
Share

But you can change meshes, right?

avatar image
0

Answer by Lord Moon · Jun 04, 2011 at 04:07 AM

Just add a script that does it here is one that makes it red...just change teal to any color you want

 function Update () {
 
 renderer.material.color = Color.red;
 
 }



Simple ;)

Comment
Add comment · Show 3 · 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 Craig Farrell · Jun 04, 2011 at 08:25 PM 0
Share

I thought this only worked with dynamic fonts (not available on mobile platforms)?

avatar image Crys · Jun 05, 2011 at 01:26 PM 0
Share

I tried this on GUITexts and it there was nothing there? There is no attached renderer.

avatar image p_unity · May 28, 2013 at 08:45 AM 0
Share

yeh don't change the renderer. Ins$$anonymous$$d just access the material.

 var TextToChange : GUIText ; // Drag GUIText here
 
 function Start () {
 
     TextToChange.material.Color = Color.yellow;
 
 
 }     
avatar image
0

Answer by Sasa · Aug 02, 2011 at 10:35 AM

This will do :)

var tex : Transform;

function Start() {

 tex.guiText.text = "Hello";
 tex.guiText.material.color = Color.green;
 
 
  

}

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
0

Answer by MaDDoX · Nov 21, 2012 at 07:34 PM

Try this code, it'll allow you to change text mesh color interactively during edit time, and (just to be picky) it won't change anything during play:

 using UnityEngine;

 [ExecuteInEditMode]
 public class SetTextMeshColor : MonoBehaviour {
 
     public Color TextColor = Color.black;
     private Material _material ;
 
     void OnEnable () {
         _material = GetComponent<MeshRenderer>().sharedMaterials[0];
         _material.color = TextColor;
     }
 
     void Update() {
         if (Application.isPlaying) return;
         _material.color = TextColor;
     }
 }
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
  • ›

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

7 People are following this question.

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

Related Questions

3d text color 2 Answers

Text/font color 3 Answers

Change text color from event trigger 1 Answer

Text Changes to Black 7 Answers

Replacing transparency of text with a solid color? 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