What I basically wanted to do was just create a login screen, however i’ve been unable to figure out why I cannot type in into my TextArea box. My first thought is that OnGUI is actually a continual fired loop. All I really want to do is with the below code, be able to type whatever I want tinto my two Text Area boxes. What I doing wrong, and what is the best way to handle it?
Thanks!
using UnityEngine;
using System.Collections;
public class DisplayPlayerCreation : MonoBehaviour
{
private string _FirstName { get; set; }
private string _LastName { get; set; }
// Use this for initialization
public enum CreatePlayerStates
{
RACE, //SELECT THE PLAYERS RACE
CLASS, //SELECT THE PLAYERS CLASS
GENDER, //SELECT THE PLAYERS GENDER
RELIGION,//, SELECT THE PLAYER RELIGION
Hold //to stop Gui from loading?
}
private RaceCreationGUI raceGUI = new RaceCreationGUI ();
private CreatePlayerStates currentState;
void Start ()
{
currentState = CreatePlayerStates.RACE;
_FirstName = “”;
_LastName = “”;
}
// Update is called once per frame
void Update ()
{
switch (currentState) {
case(CreatePlayerStates.RACE):
break;
case(CreatePlayerStates.CLASS):
break;
case(CreatePlayerStates.GENDER):
break;
case(CreatePlayerStates.RELIGION):
break;
}
}
void OnGUI ()
{
if (currentState == CreatePlayerStates.RACE) {
GUI.Label(new Rect(50,280,100,25), “First Name:”);
GUI.TextArea(new Rect(125,280,100,25),_FirstName);
GUI.Label(new Rect(50,315,100,25), “Last Name:”);
GUI.TextArea(new Rect(75,315,100,25),_LastName);
raceGUI.DisplayRaceSelection();
}
}
}