Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

How to draw a text underline?

Discussion in 'Extensions & OnGUI' started by forest_linshs, Jan 19, 2010.

  1. forest_linshs

    forest_linshs

    Joined:
    Jan 6, 2010
    Posts:
    39
    Hi, everybody! I need your help.

    In GUIText , Label, or other captions, some keywords need to be signed by underline.

    like this

    I can't fix it. Could you give me any good suggestion?
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Unity imports a given font exactly as it is and can only use the original version (ie, it can't add styles on the fly). To get underlines, you should import an underlined version of the font separately and use it wherever necessary.
     
  3. forest_linshs

    forest_linshs

    Joined:
    Jan 6, 2010
    Posts:
    39
    Thanks for repay
     
  4. pallzoltan

    pallzoltan

    Joined:
    Apr 2, 2012
    Posts:
    11
    WOW, how stupid this is! I'm pulling my hair out trying to make a link look like a link. It's so dumb having to import every font a million times for every variation, and that Unity GUI is incapable of such basic tasks.
     
    anp and eddieone like this.
  5. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    The answer above isn't completely true, because underline could be done with custom GUIStyle for your label using the background graphics. You could also set different graphics for normal, hover etc.

    Bold and italic couldn't be done this way though.

    Also, check out this link for CSS in Unity.
     
  6. OLP

    OLP

    Joined:
    Oct 19, 2012
    Posts:
    6
  7. Ghorre

    Ghorre

    Joined:
    May 7, 2014
    Posts:
    11
    Correct me if I'm wrong but ain't it possible nowadays with a RichText option ?
     
  8. eddieone

    eddieone

    Joined:
    Jul 19, 2014
    Posts:
    8
    Where to find underlined arial font?
     
  9. OLP

    OLP

    Joined:
    Oct 19, 2012
    Posts:
    6
    Rich text in Unity doesn't seem to support Underline yet, although I didn't try it: http://docs.unity3d.com/Manual/StyledText.html
     
  10. MichiealO

    MichiealO

    Joined:
    Jul 7, 2013
    Posts:
    59
    Not trying to necro this, just this is the one that google pulls up when one searches for how to underline text in the UI (even on 5.6.1), so...
    The location of one's fonts in Windows is typically C:\Windows\Fonts. Unity will import and use most ttfs... (Adding for posterity, and new users.)
     
  11. Jace-Xanthos

    Jace-Xanthos

    Joined:
    Nov 25, 2017
    Posts:
    2
    My solution to the lack of underline was to duplicate the text object and replace the text to fill in the underline with adjacent underscores. The underscores look solid as long as you keep the transform of both text objects the same.