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
0
Question by $$anonymous$$ · Feb 11, 2014 at 04:21 PM · androidresolutionscalegui-problem

Is there way to apply scale on guitext?

Hi guys, first I want to apologize for my bad english, I come from Slovakia

My question is:

I started to develop games for android, but my problem is, that when I give my app into mobile with medium resolution ( 1280x720) it looks pretty good, but when I give it into devices with FULL HD resolution my GUIText is too small, nobody can read that. So I want auto scale for this text but when I was searching it on the internet I only found with OnGUI() but I dont create new main menu and text which are there, so is there way to apply auto scale for GUIText which are already exist?

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 KiraSensei · Feb 11, 2014 at 04:45 PM 0
Share

$$anonymous$$ake the font size a function of the resolution in a script and attach it to the concerned game object

avatar image $$anonymous$$ · Feb 11, 2014 at 05:01 PM 0
Share

ok so if I understand because I am new into it. so i create in hierarchy guitext and name will be for example score text, so next i create script where i put function for resolution a this script put into this guitext?

avatar image KiraSensei · Feb 11, 2014 at 05:11 PM 1
Share

You attach the script to the game object that handles the GUIText.

Your function should look like :

 function Start() {
     var myText = GetComponent(GUIText);
     myText.fontSize = Screen.height / 50;
 }

I put 50 as an example, you need to test what value you really want. If you want it bigger, you need a little number.

avatar image $$anonymous$$ · Feb 11, 2014 at 05:27 PM 0
Share

it looks very easy :) thanks a lot :) i will try it :) after that a will send there comment if it works :)

1 Reply

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

Answer by iamvishnusankar · Feb 11, 2014 at 06:42 PM

Try this alternative, Works for both Lanscape and Potrait mode

function Start() {

 var myText = GetComponent(GUIText);

 // 50 is the fontsize you want to use
 myText.fontSize = Mathf.Min(screen.height,screen.width)/50;


}

Comment
Add comment · Show 7 · 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 $$anonymous$$ · Feb 11, 2014 at 07:05 PM 0
Share

thanks people :) it works perfect :) many thanks :)

avatar image robertbu · Feb 11, 2014 at 07:45 PM 0
Share

@LadlQe - If your question is answered, please click on the checkmark next to the answer to close it out. Thanks.

avatar image $$anonymous$$ · Feb 11, 2014 at 08:06 PM 0
Share

heh it's very stupid, buut where is that checkmark? :D because I cant find it :D I can see only edit, delete, more and so on

avatar image KiraSensei · Feb 11, 2014 at 08:08 PM 0
Share

It is on the left of the answer, not the question

avatar image RandomCharacters · Feb 26, 2014 at 03:40 AM 0
Share

That worked. The bigger the number (like 50) the smaller the text. SO why can't unity just come with a autoscaler built in?

Show more comments

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

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

Related Questions

How-to-make-GUI-Buttons-on-GUI-Texture-resolution-independent 0 Answers

Correct use to scale Text and Rect? 1 Answer

Android GUI resize problem 1 Answer

Scaling problem android 1 Answer

[Android] Screen Scaling?! 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