0
\$\begingroup\$

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 a 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: (https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/StyledText.html) and many other pages on Unity site but I am now going around in circles not achieving anything.

Thanks for any help.

enter image description here

EDIT: Since DMGregorys comment. I am posting picture of my import settings on the modified (coloured-in) font PNG file:

enter image description here

EDIT 2: The 3rd screenshot shows the 'Text' objects settings. Note I have changed Material to be my extracted one. 4th screenshot shows that Material's settings

enter image description here enter image description here

enter image description here

\$\endgroup\$
1
1
\$\begingroup\$

I'm unable to reproduce this problem. Here are the steps I took, following an earlier answer on this topic:

  1. Drag a .otf font file into my project folder, and select the font asset this creates.

  2. Set its font size to my desired value, and change the "Character" field from "Dynamic" to "ASCII default set"

  3. Click the ⋮ at the top-right of the font inspector and select "Create Editable Copy". To make it easier to sort out what was the new versus the old, I named the new font asset, material, and texture "Custom Font Asset" / "Custom Font Material" / "Custom Font Texture".

  4. Edit the "Custom Font Texture" in a paint program to have the 2-colour look I wanted.

  5. Change the "Custom Font Texture" import settings to use Automatic format (not Alpha-8), Alpha Is Transparency, Alpha Source = Input Texture Alpha, Generate Mip Maps.

  6. Create a new Text component in my scene.

  7. Set the Text component's Font field to point at my "Custom Font Asset". I left the Material section saying "None".

  8. My two-colour font appears in the scene and game view as desired.

\$\endgroup\$
6
  • \$\begingroup\$ Kind of you to write this up for me. Sadly I have to go work for the evening in a few minutes. But as soon as I am back home I will be trying this out again. Thanks for all your help mate! \$\endgroup\$ – I_Keep_Trying May 23 at 14:48
  • \$\begingroup\$ You don't need to accept an answer before you've tested it. \$\endgroup\$ – DMGregory May 23 at 14:48
  • \$\begingroup\$ LOL but I am 100% sure you are correct. I ticked it almost without thinking. Will check back later and accept it for real then :P \$\endgroup\$ – I_Keep_Trying May 23 at 14:49
  • \$\begingroup\$ Sorry, where was the Alpha8 by default. I never see that on my texture import settings and perhaps this is what I have missed. Mine has 'Alpha Source= none' by default. Which i have set to Input Texture Alpha \$\endgroup\$ – I_Keep_Trying May 23 at 14:51
  • \$\begingroup\$ Oh wait, i see Alpha 8 format. But mine already defaulted to Automatic. Well the only difference I see is that I imported originally the TTF and you say OTF. Will try that next then \$\endgroup\$ – I_Keep_Trying May 23 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.