I have several inputfields and I want to write data in them. How do I determine the focus so that the data goes into the right one? Right now my code is:
private InputField input1;
private InputField input2;
public void Receive(int x){
//InputField1 & InputField2 are names coming from Unity
input1 = GameObject.Find ("InputField1").GetComponent<InputField>();
input2 = GameObject.Find ("InputField2").GetComponent<InputField>();
if (input1.isFocused) {
input1.text = x.ToString();
}
else if (input2.isFocused){
input2.text = x.ToString();
}
}
Now the data goes nowhere.