• 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
Question by Martin Brownlow · Mar 30, 2011 at 06:40 PM · textmeshfontsize

TextMesh characterSize vs fontSize

Hi all,

I'm having some trouble with the sizing TextMesh objects.

Specifically, the meaning of characterSize seems to change with the fontSize.

Fonts created with a larger fontSize are larger for the same value of characterSize as fonts created with a smaller fontSize. If you have a dynamic font, then a charSize of 16 and a fontSize of 8 is the same as a charSize of 8 and a fontSize of 16.

The problem is, there is no way in the script interface of finding out the fontSize, so even if I figure out the relationship and how to make my font a given number of units tall, I have no way to calculate the correct values in script. (without telling the artists, all fonts should have a fontSize of n).

Does anybody have any insight? Should I just roll my own text system? (I have a text system from our previous games that works pretty well, but I'd prefer to use the inbuilt Unity one if at all possible)

Thanks, Martin

Comment

People who like this

0 Show 0
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

2 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Martin Brownlow · Mar 30, 2011 at 07:23 PM

OK it turns out that by the wonders of hidden magic numbers, here is how to work out characterSize for a given fontSize and target size in world units:

characterSize = targetSizeInWorldUnits*10.0f/fontSize;

Of course, you can't actually read fontSize from the font in any way shape or form.

But that's how to do it.

Comment
dissidently
Ludeme Games
gregroberts
dmvincent
Teagarden

People who like this

5 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 dissidently · Mar 30, 2011 at 09:15 PM 0
Share

WoW. How did you figure that out?

And how stoked are you that it's not possible to read font size? Let alone change it. Welcome to Unity Answers.

avatar image

Answer by Jason B · Mar 30, 2011 at 06:43 PM

Font size effectively changes the resolution of the font. Turn your font size super small, and your character size super big, and your text will look like crap. Do the opposite, and you'll have very nice, smooth letters.

TextMeshes have numerous flaws though with their general operation, and there's not really anything they can do that a GUIText can't do better (unless you specifically need text to follow objects around in the 3D world).

Comment

People who like this

0 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 kUr4m4 · Oct 24, 2013 at 02:21 PM 0
Share

Except you can add Depth to TextMeshes, which you can't do to GUIText since there is no option to select a specific shader/material

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

How can I obtain an exportable font size? 0 Answers

Best way to properly scale text? 0 Answers

Textmesh Username for networkplayers. help. 1 Answer

TextMesh and pragma strict together, issue 1 Answer

Accentuated Characters using TextMesh from script 1 Answer


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