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
3
Question by Projekt_Spartan · Feb 13, 2015 at 05:19 PM · uiiostextfont

Why are my Unity UI fonts rendering incorrectly?

I am having a problem with the Unity UI Text component on iOS where the text will be missing seemingly random letters, or the characters will just disappear entirely. I can't seem to reproduce the issue in editor.

Here are some screenshots:

alt text

alt text

The text on this button is supposed to say "Collect". Sometimes letters are missing (not always the same letters), and other times none of the letters appear at all, but this issue isn't happening 100% of the time. Sometimes I will load the scene with this UI element, and it will appear completely fine.

I have tried using a number of different fonts, including both the default Arial, and custom .otf fonts, but they all exhibit the same behaviour. All of these fonts have been set to dynamic, as I assume is required for the canvas scaler to work on them.

The canvas that the UI elements are on is set to Screen Space - Overlay, and has a Canvas Scaler component attached.

Screenshots of the Canvas, Text, and Font: http://imgur.com/a/aSMyG

Edit: This problem goes away if I set the font to "Unicode" instead of "Dynamic". Problem then is that the larger Text element fonts are being scaled up instead of actually increasing font size, causing blurry text. I can increase the size of the imported font to fix this, but it's not exactly ideal.

Edit 2: Messed up font where text ISN'T missing, but the characters are incorrect. http://imgur.com/a/4p2Ct I think this may be the same problem, or at least a related issue.

text3.png (46.5 kB)
text4.png (63.8 kB)
Comment
Add comment · Show 4
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 chadli · Feb 17, 2015 at 10:52 PM 0
Share

Have you tried switching to a different font?

avatar image Projekt_Spartan · Feb 18, 2015 at 04:06 PM 0
Share

I have tried using a number of different fonts, including both the default Arial, and custom .otf fonts, but they all exhibit the same behaviour.

avatar image StefanoCecere · Apr 01, 2015 at 11:35 AM 0
Share

hi.. did you find the cause/solution? i'm finding the same odd random behaviour! also the latest 4.6.4 doesn't solve the bug

at the end i converted this text (i have hundreds of labels, and just one has this bug!) into a texture...

very very strange bug

ADDENDU$$anonymous$$: still having this but with latest Unity 4.6.7

avatar image PuLieNDo · Feb 26, 2016 at 01:02 PM 0
Share

Also happens in 5.3.2f1 with some iOS devices. Same random behaviour. Didn't try the solution below.

4 Replies

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

Answer by Projekt_Spartan · Apr 02, 2015 at 06:14 PM

Yeah, I found the problem, and came up with a solution that works - though it isn't exactly ideal. Basically, the font atlas on device is getting full, and as far as I can tell is removing characters from the texture when it has to add new ones. Unfortunately the text.font.characterInfo list isn't removing the characters from it's list, so when requesting the characters for the text, it returns a valid character that isn't actually in the atlas. I fixed it by clearing the character list in the font, and then manually requesting each character in my string with this piece of code, where "text" is a Unity UI Text component:

 public void ResetText(bool deleteFontCharacterInfo = false)
 {
     if (text)
     {
         if (deleteFontCharacterInfo)
         {
             text.font.characterInfo = null;
         }
 
         text.font.RequestCharactersInTexture(text.text,text.fontSize, text.fontStyle);
         text.FontTextureChanged();
     }
 }
 

That being said, I believe that this was fixed in the recent Unity 5 update on Unity's end.

Comment
Add comment · Show 5 · 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 dustinfreeman · Jun 29, 2015 at 09:23 PM 0
Share

On Unity 5 here. Doesn't look like it is fixed.

avatar image mauri11 · Aug 28, 2015 at 07:09 PM 0
Share

Dude thank you!!!!

avatar image craigitsfryday · Mar 29, 2017 at 03:10 PM 0
Share

I'm in 5.5.0f3. Still happening.

avatar image Bill-Ape · Apr 24, 2017 at 03:14 PM 1
Share

When are you actually calling this method? When do you ResetText? Is it on some event or is it purely manual?

avatar image josenunes · Jun 16, 2017 at 10:31 AM 0
Share

Still happening. Could you clear when you are actually calling the method? Thanks in advance

avatar image
1

Answer by Bill-Ape · Apr 25, 2017 at 10:07 AM

So I came across this too and found a bug in the Unity UI code running with 5.4.0

It seemed to be caused by a bug whereby destroyed Text elements would not be removed from the FontUpdateTracker, then the FontUpdateTracker.RebuildForFont call would iterate forwards through the list, which would be modified while iterating through and miss some entries. I made a fix here and rebuilt the UnityEngine.UI solution and installed it in my system Unity folder at the location specified in the UI project.

https://bitbucket.org/bill_robinson/unityengine.ui/diff/UnityEngine.UI/UI/Core/FontUpdateTracker.cs?diff1=c614f7a5ae1a&diff2=0235856503a17667e97b4b985fe077cef292c588&at=5.4

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 josenunes · Jun 16, 2017 at 02:14 PM 0
Share

How can I fix this without changing UI namespace classes? I tried to call FontUpdateTracker.UntrackText in OnDestroy function

avatar image
0

Answer by cmarker_wilson · Jul 12, 2016 at 05:35 PM

It looks like the 'vertical overflow' is set to 'truncate'. If you set it to 'overflow' it will probably fix it. I just came across this issue earlier and noticed setting font size > 25 made the text disappear. In your examples it seems to be the taller letters being cut off/truncated.

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 Projekt_Spartan · Jul 12, 2016 at 05:46 PM 0
Share

I could be mistaken, but I'm fairly sure that the vertical truncate will only work on a line-by-line basis, not letter-by-letter.

Regardless, this was not the issue. It was a problem with how letters were being added to the font atlas internally, and has since been fixed I believe.

avatar image
0

Answer by kathryn-webb · Jul 22, 2016 at 03:41 PM

I had a similar problem with 3D Text, but seeing as there is no FontTextureChanged() function I had to improvise...

 void Awake()
 {
         textMesh = (TextMesh)GetComponent(typeof(TextMesh));
         resetChars();
         textMesh.text = "Ready";
 }
 
 void resetChars()
 {
       textMesh.text = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
       textMesh.font.characterInfo = null;
       textMesh.font.RequestCharactersInTexture(textMesh.text, textMesh.fontSize, textMesh.fontStyle);
 }

I was only making a limited prototype so I just added a basic charset but if you want a full solution you would need to add symbols and special characters (#,~...etc)

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

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

11 People are following this question.

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

Related Questions

Try to reproduce this Text UI element "bug" if you are developing for IOS 0 Answers

Text Meshes not rendering correctly on iOS device 1 Answer

How to change text on a TextMesh with a non-dynamic font on iOS? 2 Answers

IOS Unity 5 UI, Font/Text not displaying/Disappearing 3 Answers

Getting width of a character in new 4.6 UI system? 0 Answers


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