GUI.Label(new Rect(Screen.width/2 - 50,Screen.height/2, 50,30),"Name:");
playerName = GUI.TextField(new Rect(Screen.width/2,Screen.height/2,100,30),"",20);
if(GUI.Button(new Rect(Screen.width/2,Screen.height/2 + 40,100,30),"Play")){
GameControl.control.playerName = playerName;
Debug.Log(GameControl.control.playerName);
}
playerName is a class variable btw, made private (“private String playName;”)
Basically, when I click on the text field, it becomes non responsive.
Everything displays too, or is because of my state machine?
void Start () {
pointsLeft = 10;
startScreenStates = StartScreneStates.CHARACTERSCREEN;
}
// Update is called once per frame
void Update () {
}
void OnGUI(){
StartScreenStateMachine();
}
void StartScreenStateMachine(){
switch(startScreenStates)
{
case StartScreneStates.TITLESCREEN:
//Debug.Log("Press START");
ShowTitleScreen();
break;
case StartScreneStates.STARTSCREEN:
//Debug.Log("Press PLAY");
ShowGameOptions();
break;
case StartScreneStates.CHARACTERSCREEN:
//Debug.Log("ChooseCharacter");
ChooseCharacter();
break;
case StartScreneStates.STATSSCREEN:
//Debug.Log("Alocate Stats");
ChooseStatsAllocation();
break;
case StartScreneStates.FINALSETUP:
//Debug.Log("PLAY");
//This is where it freezes when I want to enter name
EnterNameSave();
break;
}
}
Is anyone facing any problems with this?
It worked fine before when I attempted it, but now I can’t tell what is the problem.
P.S - I have tried TextArea as well.