Inserting text into GUILayout Box?

Hello. I've a problem putting in text into my GUILayout box. Here is my script:

function OnGUI()

{

GUILayout.BeginArea( Rect( 2, Screen.height 50, 50, 55 ), "Testt", GUI.skin.window);

guiText.text.enabled("Hello");
guiText.pixelOffset = Vector2 (30, 20);

GUILayout.EndArea();

}

I have other functions inside the box as well, not shown here. I just want to put in a text for display purposes only; no functions whatsoever.

This script can't be compiled; what am I doing wrong?

If I might recommend you take a look at the GUI documentation, GUILayout documentation, and GUI tutorial in Unity's Documentation, I think that'd help you out a lot. That being said, I think this is what you wanted to do:

function OnGUI()

{

GUILayout.BeginArea( Rect( 2, Screen.height 50, 50, 55 ), "Testt", GUI.skin.window);

GUILayout.Text("Your text here!");

GUILayout.EndArea();

}

Ok, I've found a solution - add a label inside the GUIbox.

function OnGUI()

{

GUILayout.BeginArea( Rect( 2, Screen.height 50, 50, 55 ), "Testt", GUI.skin.window);

  GUI.Label (Rect (30, 100, 100, 30);

GUILayout.EndArea();

}

I realised that the few sets of numbers in the brackets are coordinates for where the GUI is to be placed. =)

I think you might want to use this:

GUILayout.TextArea ( "Hello World

I’ve got 2 lines…", 200);

See http://unity3d.com/support/documentation/ScriptReference/GUILayout.TextArea.html