I have 4 inputfields, and in each field i need to enter a name. name 1 , name 2 , name 3 , name 4. my issue is that i have a class that get's me the text in the inputfield, and other class that is my manager that handles sending the data i get from the field across the network. My problem is that I can't figure out how to store the all my fields. What i get now in my console is Name 1 = two , name 2 = two. It must be name 1 = one , name 2 = two.
public string name1;
public string name2;
public string name3;
public string name4;
public InputField input;
// Use this for initialization
void Start () {
}
// Called in Inputfield OnEndEdit Event.
public void OnEndEdit()
{
name1 = input.text;
name2 = input.text;
name3 = input.text;
name4 = input.text;
}
And this is my other script my manager:
private InputFields inputFields;
void Start () {
inputFields = FindObjectOfType<InputFields>();
}
public void GetUserData ()
{
Debug.Log ("Message 1 " + inputFields.name1 + "Message 2 " + inputFields.name2 + " Message 3 " + "Message 4" );
}
}
So To recap i have 4 UI inputfields and i just want to get text from them and store them in my string. The inputFields script is attached to each inputfield.