- Home /
Question by
JoshMBeyer · Jun 07, 2014 at 10:39 AM ·
playerprefstextfield
How to check if the content of Textfield is equal to PlayerPrefs
I am trying to figure out how to check if the string content of the text field is equal to the playerprefs "Pin" value, if so, give acess, else, print wrong pin.
How would I do this? So far I have
PINField = GUI.TextField(new Rect(5, 50, 200, 25),PINField , 25);
//Confirm Button
if (GUI.Button (new Rect (5, 100, 200, 25), "Confirm")
&& PINField.Contains (PlayerPrefs.GetString("UserPin")))
{
print("Access Granted");
}
else{
print("Access Denied");
}
Comment
Answer by JoshMBeyer · Jun 07, 2014 at 10:58 AM
Never mind I figured it out myself.
PINField = GUI.TextField(new Rect(5, 50, 200, 25),PINField , 25);
//Pin Field
//Confirm Button
if (GUI.Button (new Rect (5, 100, 200, 25), "Confirm") )
{
if(PlayerPrefs.GetString("Player Name") == PINField)
{
print ("Access Granted");
}
else
{
print ("Access Denied");
}
}
Your answer
Follow this Question
Related Questions
How do i Copy Textfield text to my label 1 Answer
Get playerPrefs of connections? 1 Answer
GUI.TextField problem, won't update var. 0 Answers