Question by
bonsaisushi · Mar 16, 2018 at 07:11 PM ·
c#stringinputfieldcheck
Check if 2 InputField contains 2 words (not the same)? Feel like it's easy but can't figure out what's wrong
I have to check if in 2 Input Fields there are some particular words, I'm currently using this but it fails to work
public GameObject inputfield1;
public GameObject inputfield2;//InputField gameobject
private string input1; //Strings that are contained in input field
private string input2;
public void PriDueParolePI1()
{
//Bottone1IPP1.SetActive(false);
input1 = inputfield1.GetComponent<String>();
input2 = inputfield2.GetComponent<String>();
List<string> words= new List<string>();
words.Add("fogna");
words.Add("cavallo");
if (parole.Contains(input1) && parole.Contains(input2))
{
DueParolePP = DueParolePP + 2;
input1 = default(string);
input2 = default(string);
words.Clear();
Debug.Log("Okay1");
}
else
{
DueParolePP = DueParolePP + 1;
input1 = default(string);
input2 = default(string);
words.Clear();
Debug.Log("NotOkay1");
}
}
Comment
What does the parole variable supposed to be ? another list ? That should give out an error since i don't see parole declared anywhere
Your answer
Follow this Question
Related Questions
Use InputField to be a search bar with a ScrollRect 0 Answers
I need help with input field ui. 0 Answers
function based on return value 2 Answers
How to get the active/loaded Scene then turn the name of it into a string? [C#] 1 Answer
How to change a public location,how to get a public variable 1 Answer