|
Hallo everyone, Im currently working on a project where player can add their own text into the game. Im using GUI.labels to store the text. But if i write a pretty long word the word eventually goes offscreen. Is there a way to force the text to stay in the Label boundaries and automatically rescale itself to a smaller size when he reached the boundary? The project is for the iPhone. I know font scaling is prohibited on iPhone so maybe there is a workaround like a scrollbar or something? Here is my code: the tempWord & currentWord are the string which are being handled in another function. The matrix handles rescaling on different resolutions. Thanks in advance.
(comments are locked)
|
|
Have you tried GUIStyle.wordWrap? I had not. Thanks for the tip, but there is still one problem. WordWrap seems to wrap the text only on the horizontal axis, so when a user adds a long word the text just jumps a line under and continues there.
Nov 18 '11 at 08:27 AM
hatzalex
(comments are locked)
|

Not sure if this would work in your case but you could check the string length and then use an appropriate GUIStyle. I mean, if your is string size is > X & < Y then use GUIStyle normal_sized_style, else if string size is > Y use GUIStyle small_sized_style...
Worked like a charm mate, here is the full code for the interested:
function OnGUI() {
}