You can do this by first getting a link to gameObject, then getting the component from it InputFieldand selecting a variable text:
GameObject inputFieldGo = GameObject.Find("PathToTheGameObject");
InputField inputFieldCo = inputFieldGo.GetComponent<InputField>();
Debug.Log(inputFieldCo.text);
source
share