0
\$\begingroup\$

I'm trying to create a custom font to use (just for numbers). I've divided a 1280x512 file into a 5x2 grid of 256x256 spaces, put my custom drawing into the boxes through 0 to 9, saved it as transparent PNG. Here is a screenshot from Photoshop:

enter image description here

I've created a custom font, made the ASCII start offset 48, left everything default, created 10 character rects from index 0 through 9. Here is a screenshot showing everything clearly instead of writing everything one by one:

enter image description here

On the sixth element UV Y becomes 0, the rest goes the same.

I create a default GUI text, select my font and write 0123, but here is the result:

enter image description here

All the characters are on top of each other. The font is not obeying the Advance property. I've tried different values but it doesn't work for any positive value for the advance property. If I give a negative value, it works (e.g. puts the character at the right, as if I'm using a RTL language like Arabic) but of course, this is not what I want. If I type just one character it displays perfectly at the right place so I don't think there's any UV issue here. It really looks like I'm doing something wrong with the Advance value, but whatever I've tried (positive, negative, zero, huge numbers, fractions etc.) it doesn't work (with the exception of negatives that I've explained) I'm on Unity Personal 5.4.3f1.

What am I doing wrong?

UPDATE: Just updated to the new 5.5 version, still the same.

\$\endgroup\$
4
  • \$\begingroup\$ you didn't gave value on Character padding. enter value on it \$\endgroup\$ Commented Dec 3, 2016 at 7:16
  • 1
    \$\begingroup\$ @ManojBalajiM you didn't even look at the question. it's right there on the screenshot. \$\endgroup\$ Commented Dec 3, 2016 at 9:04
  • \$\begingroup\$ character padding you game as 0 chage it to 2 or 3 then check it \$\endgroup\$ Commented Dec 3, 2016 at 9:22
  • \$\begingroup\$ @ManojBalajiM tried many values, even 100. absolutely nothing changes. \$\endgroup\$ Commented Dec 3, 2016 at 12:25

2 Answers 2

1
\$\begingroup\$

I've replicated your font and it seems to do the job on my end (of course mine changed the pixel sizes etc. but still it works quite well, apart from the obvious quality flaws from copy pasting) Also, I've used a png file, which seems to work better with Unity.

Here are some screenshots so you can compare yours to mine (I'm thinking you're using the wrong shader for your material or the import settings of your texture might be wrong because the font file seems identical to mine): enter image description here enter image description here enter image description here

\$\endgroup\$
1
  • \$\begingroup\$ See my answer. Apparently it wasn't the font, but a problem arising from the text object using the font being small and the font being too large. \$\endgroup\$ Commented Dec 4, 2016 at 15:23
0
\$\begingroup\$

I was trying to replicate a YouTube tutorial at https://www.youtube.com/watch?v=GRvey8Pb_Fo.

The original author of the tutorial suggested me to change the Horizontal Overflow property to Overflow instead of Wrap the Text object that was using the font with (not the font asset itself). That was it.

Because my font was too big, it was wrapping on itself as the text area wasn't wide enough.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .