- Home /
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?
$$anonymous$$ake the font size a function of the resolution in a script and attach it to the concerned game object
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?
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.
it looks very easy :) thanks a lot :) i will try it :) after that a will send there comment if it works :)
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;
}
thanks people :) it works perfect :) many thanks :)
@LadlQe - If your question is answered, please click on the checkmark next to the answer to close it out. Thanks.
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
That worked. The bigger the number (like 50) the smaller the text. SO why can't unity just come with a autoscaler built in?
Your answer
Follow this Question
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