Enable Button from Textfeild

Ave,

I’m currently working on a main menu screen, but I’m stumped as to how to enable a button when the textfield has text in it.

I’ve looked at lots of different answers but I’m really unsure how to proceed.

Here’s my current script. so any advice would be greatly appretiated.

var _name   :  String = "";

function OnGUI () 
{
	_name = GUI.TextField(Rect(420,170, 60, 20),_name, 7);

	if (GUI.Button( Rect(400,200,100,30),"Start Game"))
	{
		Application.LoadLevel ("sceneLevel1");
		PlayerPrefs.SetString("NAME", _name);		
	}
	
	if (GUI.Button( Rect(400,240,100,30),"How To"))
	{
		Application.LoadLevel ("sceneScreenHowTo");
	}
	
	if (GUI.Button( Rect(400,280,100,30),"High Scores"))
	{
		Application.LoadLevel ("sceneScreenHS");
	}
	
		if (GUI.Button( Rect(400,320,100,30),"Credits"))
	{
		Application.LoadLevel ("sceneScreenCredit");
	}
}

Just put whatever you want to be enabled when the string isn’t empty into this if statement:

if( _name != "" )
    {
       // Button Goes Here
    }

Whenever the string isn’t empty, it will make that if statement TRUE.

Thanks Jake Much Appreciated.

Can I ask what ! means?