I need help solving the error that is in the title.
1. DevLogin.cs(5,35): error CS0103: The name `String' does not exist in the current context
2. DevLogin.cs(6,35): error CS0103: The name `String' does not exist in the current context
using UnityEngine;
using System.Collections;
public class Devlogin : MonoBehaviour {
private string username = String.Empty;
private string password = String.Empty;
private bool correctLogin;
void Update (){
correctLogin = (username == "LegendWill" && password == "admin");
}
void OnGUI (){
Rect windowRect;
windowRect.x = Screen.width / 2 - 100;
windowRect.y = Screen.height / 2 - 50;
windowRect.width = 200;
windowRect.height = 100;
GUI.Window(0, windowRect, OnWindowGUI, "Authentication");
}
void OnWindowGUI (){
username = GUILayout.TextField(username);
password = GUILayout.PasswordField(password, '*'[0]);
if (GUILayout.Button("Login") && correctLogin)
{
Debug.Log("You logged in!");
enabled = false;
}
}
}
↧