How to fit a long sentence in a GUI.button

I have a button which i want to display a long sentence. So what can i do to fit it into the button, what i think is making 2 rows, but i have no idea how to do, any suggestions and helps?

You want to look at your GUIStyle's text wrap mode. To do this you will have to assign a custom GUIStyle, as per documentation [here][1]. [1]: http://unity3d.com/support/documentation/Components/class-GUIStyle.html

1 Answer

1

Add a GUIStyle variable to your script and set Word Wrap - this will break the lines when you use this style to draw anything:

var style: GUIStyle;

function Start(){
    style.wordWrap = true;
}

function OnGUI(){
    GUI.Button(Rect(10,200,300,200), "Button with a long name", style);
}