Search Unity

2-Color Fonts in Unity? (so maybe called 3-Color including transparent alpha?)

Discussion in 'UGUI & TextMesh Pro' started by megabrobro, May 23, 2021.

  1. megabrobro

    megabrobro

    Joined:
    Jul 8, 2017
    Posts:
    109
    Hi, I have been trying to make my game title screen look better. I realised it was because all my fonts have just one colour.

    I read some very old threads about Editor Scripts to extract the font to png format. I then see there is now a way to do it in the 'hamburger' menu of the Font in Inspector.

    I had to change my font to be not 'Dynamic' then it allowed me to extract a copy to PNG. I opened this in GIMP and added my white inside the outlines of each character (it had been alpha before this, giving a horrible see-thru effect on the letters).

    I put this back into Unity (the new PNG) and used it as the source texture for my Text Shader. However it is still not handling both colours. (Screenshot below). So what can I do using Unity 2020 to achieve better looking text? I've read this: Rich Text | Unity UI | 1.0.0 (unity3d.com) and many other pages on Unity site but I am now going around in circles not achieving anything.

    Thanks for any help.

     
    Last edited: May 23, 2021
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Have you considered using TextMeshPro (TMP) instead of the UI Text component?

    Since TMP uses Signed Distance Field as its primary text rendering, you get the ability to easily add an Outline, Shadow, Face and Outline texturing, etc. by simply tweaking material properties.

    Take a look at the following video which talks about Material Preset which is how you would manage multiple different visual style for your text.



    and then take a look at the following video of some additional functionality coming to better support SRP.

     
  3. megabrobro

    megabrobro

    Joined:
    Jul 8, 2017
    Posts:
    109
    Hi thanks for the helpful info. Yes I did consider TextMeshPro and one day will study it further. In the end the solution was simple and I got the answer from asking on another site. Here is the link to the answer, which he wrote in simple steps almost anyone can follow. https://gamedev.stackexchange.com/a/192580/59241