x


Scaling Text

How would you shrink and enlarge text in realtime called by the OnGUI function?

Ex.

function OnGUI(){
GUI.Label(Rect (Screen.width/HorizontalPosition,Screen.height/verticalPosition,Screen.width, Screen.height), "text"); 
  }
more ▼

asked Aug 16 '11 at 05:34 AM

FTheCloud gravatar image

FTheCloud
735 15 20 27

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Not like that. You must either use a GUIText, change the GUI matrix, or modify GUI.skin.label.fontSize. Note that regardless of technique, you may not get adequate performance if you ask for font characters in many different sizes, and you will possibly waste memory, since each needs to be rendered by the dynamic font. If you only need to do this with one string (eg. game title), then youll get best results by creating a mesh of the vector form of the text in your modeling software - that is small and completely scalable. Of you need it for many texts, then pick one large size for the characters and use the matrix to texture-scale it - that will not be hi-rez, but will perform well.

more ▼

answered Aug 16 '11 at 05:57 AM

Waz gravatar image

Waz
6.4k 22 33 71

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x552
x387
x57
x5

asked: Aug 16 '11 at 05:34 AM

Seen: 1424 times

Last Updated: Aug 16 '11 at 05:57 AM