Please Fill In the Blank- App Dev Series 3

S.J. Jason Liu
3 min readSep 5, 2021

--

Quick guide of let system can receive data from input field of UI.

While creating interactive app interface, fill in some needed information is quite common. In this quick guide, we will make the system can identify the information that user input in Input Field of Unity UI.

Input Field

To input something in Unity, you need an UI element called Input Field.

When adding an Input Field in Unity, you would need to take a further setting on input size and align.
To adjust this part, you have to run Play mode and adjust the size or align, then copy the value of component and paste it back when disable Play mode.

Unity would not display the input text under edit mode.

Once finished adjusting the Input Field, we can make the script to read this.

Get the text from field

In this example, I would make a script for this panel, and receive the data from UIManager and rewrite the name data with Input Field.
When press “Next” button, the system would receive data of user name from the column and record it in database.

In the script of this panel, set the reference of these 2 Input Field.

Don’t forget to enable the library of UI.

Then create a method for the button to send name info to system.
In this method, first let’s get the string data.

Then create an if statement to check if user actually input the data before click “Next”.

We can make a method to UIManager to receive this data.

All done! Once you Play it and test it with data inputed, you should see the result in Inspector.

--

--

S.J. Jason Liu
S.J. Jason Liu

Written by S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.