Game Development Reference
In-Depth Information
// Unity JavaScript user:
…
function Start () {
_page = PAGE.GAMEOVER;
_clickRestart = false;
_clickSubmit = false;
_user = new UserData();
_user.name = "PLAYER 1";
_user.score = 0;
}
// C# user:
…
void Start () {
_page = PAGE.GAMEOVER;
_clickRestart = false;
_clickSubmit = false;
_user = new UserData();
_user.name = "PLAYER 1";
_user.score = 0;
}
5. Now go to the
Gameover()
function. Inside the
if (_clickSubmit ==
false) {
line, we will add the highlighted code as follows to create the input
text field for the username:
// Unity JavaScript user:
…
private function Gameover ()
{
…
if (_clickSubmit == false) {
GUI.Label(new Rect((Screen.width - 300)*0.5f,
(Screen.height*0.1f) + 80, 300, 25), "Enter Your
Name", GUI.skin.GetStyle("CustomText3"));
//Creating the input text field to get the player