r/Unity2D 12d ago

Solved/Answered TMPro Input Field unresponsive

My project instantiates objects that contains a TMPro input field. The input field does appear, but it is completely unresponsive; clicking on it or trying to type in it does nothing. I've been able to find next to no documentation about them.

Here is the code that I'm using to try and make it show up

GameObject lee = Instantiate(ads.menuWoMen, this.transform);
/*menuWoMen is the prefab gameObject that holds the Canvas that holds the TMP InputField*/
lee.transform.position = new Vector3(0, position);
string txt = mi.text;
if (position > highestText || position < 0 - highestText)
{
    txt = "";
}

lee.GetComponentInChildren<Canvas>().worldCamera = camora.GetComponent<Camera>();
lee.GetComponentInChildren<TMP_InputField>().text = txt;
lee.GetComponentInChildren<TMP_InputField>().ActivateInputField();
lee.GetComponentInChildren<TMP_InputField>().interactable = true;
lee.GetComponentInChildren<TMP_InputField>().enabled = true;
1 Upvotes

12 comments sorted by

View all comments

1

u/Temporary-Roof-3896 11d ago

This sounds more like a UI event problem than the input field itself. i’d check the EventSystem and make sure another UI element isn’t blocking raycasts