0
\$\begingroup\$

I am trying to create InputFields in my Unity app via Script. Here is the code for the same.

TMP_DefaultControls.Resources uiResources = new TMP_DefaultControls.Resources();
GameObject uiInputField = TMP_DefaultControls.CreateInputField(uiResources);
uiInputField.name = "MyInput";
uiInputField.transform.SetParent(gameObject.transform);

This is working fine and my field is created and works okay. But the Carat is missing. When I create an InputField via the editor, the carat is generated when I run the app, but not in this case. I have been scratching my head over this and I can't figure out why this doesn't work or how to make it work. Any suggestions? Thanks!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.