Script to load a text file gives error.

The following script will not load in unity, giving out this error:

BCE0023: No appropriate version of 'UnityEngine.GUILayout.Label' for the argument list '(UnityEngine.TextAsset)' was found.

Here’s the script:

#pragma strict

var scrollViewVector : Vector2 = Vector2.zero;
var TextToDisplay : TextAsset;

function OnGUI () {
	scrollViewVector = GUI.BeginScrollView (Rect (25, 25, 100, 100), scrollViewVector, Rect (0, 0, 400, 400));
	GUILayout.Label(TextToDisplay);
	GUI.EndScrollView();
}

The script is supposed to load a *.txt file. Any advice on what I’m doing wrong is welcome.

This fails because, like the compiler says, there is no version of the GUI Label that accepts a TextAsset as its argument. Instead, you need to pass it the string contained within the asset, i.e. TextAsset.text:

GUILayout.Label(TextToDisplay.text);