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
1
Question by Anthonylinx · Dec 08, 2013 at 03:47 AM · guitextguitext

Trouble getting GUIText positioned correctly.

Hey everyone, I seem to be having trouble understanding GUIText correctly. Mainly what seems to be the problem is that if I have a GUIText positioned and scaled correctly in the game preview window it gets scaled down a lot if I hit maximize on play. I'm just not sure why it looks so differently between the two screens. A simple explanation of GUIText would be so helpful. Thanks in advance.

Comment
Add comment
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

1 Reply

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

Answer by VioKyma · Dec 08, 2013 at 05:07 AM

Basically, the higher the resolution, the smaller the font will appear because it is drawn to size in pixels.

To get around this, you can either dynamically re-size the GUIText (Set font size to a factor of the resolution (Screen.width, Screen.height) OR you can allow the user to re-size the text to their liking (much like a website with usability options).

Note that either of these will require that the Font be a dynamic font.

Comment
Add comment · Show 3 · 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 Anthonylinx · Dec 08, 2013 at 05:26 AM 0
Share

Thanks, that's very informative. I'm just confused as to what factor of the screen I should get.

avatar image VioKyma · Dec 08, 2013 at 05:44 AM 0
Share

It depends on exactly what you're looking for, but you will probably just have to fiddle with the numbers to find your desired result. I would say something like the following:

Say your base resolution is 1024x768, you can re-size the text based upon this. So you will do something like (in C#):

 int baseFontSize = 12;
 guiText.fontSize = baseFontSize * (Screen.width/1024);

So if your screen width is 1280 (720p), then the font size will be 15. If you were worried about aspect ratio, you could do something more complex with the width and height properties, but hopefully this makes it a bit clearer for you.

avatar image Anthonylinx · Dec 10, 2013 at 04:52 AM 0
Share

I just found out that size ~200 in my custom font is equal to ~20 in arial and that was causing a ton of my confusion on this. Thanks so much for your help, you're awesome!

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

17 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Problem Displaying Score on GUI text 0 Answers

Guitext hides PHP text on iphone 0 Answers

GUI: Text justification? 2 Answers

guiText.Text do not display text correctly 2 Answers

GUI Text line break Alt+Enter still does not work in Unity for Windows? 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