x


Word Wrapping Gui.Box

Been trying for a while now. Thanks for all the help that I've been getting. I've learned a lot so far. So my question.. I have changed the width of my Gui.Box and need it get it to wrap the words.

public class About : MonoBehaviour {

public Vector2 scrollPosition = Vector2.zero;
public TextAsset textAsset;
public Texture texture;
public GUIStyle style;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}

void OnGUI(){

    GUI.Box(new Rect(Screen.width / 8 + 50, 0, 1024, 1024), texture);
    GUI.BeginGroup(new Rect(Screen.width / 4 +50, Screen.height / 4 -50, 600, 600));


    //Begin Scroll Slide
    scrollPosition = GUI.BeginScrollView(new Rect(0, 0, 600, 500), scrollPosition, new Rect(0, 0, 600, 500), alwaysShowHorizontal: true, alwaysShowVertical: true);

    if(GUI.skin.customStyles.Length > 0)
        //Add content to the scroll area.
        GUI.Box(new Rect(0, 0, 600, 500), textAsset.text, style.wordWrap = true);

    //End Scroll Slide
    GUI.EndScrollView();

    GUI.EndGroup();
}

}

any clue how to get it to work correctly?

more ▼

asked Mar 14 '11 at 03:09 AM

crzyone9584 gravatar image

crzyone9584
23 7 7 13

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

1 answer: sort voted first

Check "word wrap" in the GUIStyle in the inspector.

more ▼

answered Mar 14 '11 at 04:04 AM

Eric5h5 gravatar image

Eric5h5
80.3k 42 132 521

I should of said that the error was saying

" The best overloaded method match for UnityEngine.GUI.Box(UnityEngine.Rect, string, Unity,Engine.GUIStyle) has some invalid arguments"

Mar 14 '11 at 04:08 AM crzyone9584
(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:

x3698
x161
x16

asked: Mar 14 '11 at 03:09 AM

Seen: 2091 times

Last Updated: Mar 14 '11 at 03:09 AM