- Home /
Question by
formygames280 · Aug 31, 2018 at 07:32 AM ·
c#textinputfielddisplay
I have a C# script with InputField and I want to get text from this input field to another script
I have made a script with InputField to display text on a panel, but I wanted to make a tutorial and I actualy made it, but I don't know how to display text from this InputField. Can somebody help me? This is my scripts: *1 works fine using UnityEngine; using UnityEngine.UI; using TMPro;
public class SetAndGetName : MonoBehaviour {
public InputField field;
public TextMeshProUGUI displayname;
public void name()
{
displayname.text = "" + field.text;
field.text = displayname.ToString();
}
}
public TextMeshProUGUI displaytext; if (Languages.languages == 1) { displaytext.text = "Hello" + SetAndGetName.field.text + "," + "\nMy tutorial here"; displaytext.ToString();
For languages I have another script, but that works fine, text displays but without SetAndGetName.field.text - I can not acces field because it can not be static and this is not working too:
GameObject fields = GameObject.Find("SetAndGetName"); SetAndGetName field = fields.GetComponent();
Comment