Home > Blockchain >  How to make a GameObject that prompts user for text input in Unity
How to make a GameObject that prompts user for text input in Unity

Time:07-16

I'm new to Unity and I'm trying to create an object that upon being placed by the user will prompt the user for text input. The GameObject is basically a text box. This is also meant for a mobile application.

CodePudding user response:

Fortunately, the answer is very simple and doesn't even require writing code. You can use the “InputField" UI component. You can quickly create an InputField from the menu bar entry "GameObject> UI> InputField" or "GameObject> UI> Legacy> InputField>". This way, if you didn't already have a canvas in the scene, it will be created, and an InputField will be inserted inside. The parent gameObject manages the inputField, and in fact it is the only one with the component, while the child objects are to show the text, "placeholder" for the text before inserting some text, and "text" to show the text it will write the user.

if you think my answer helped you, you can mark it as accepted and vote positively. I would very much appreciate it :)

  • Related