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");
}
}