Unity --- use of text input box

There are two versions of the text input box, one is the old version of the text input box, and the other is the new version of the input field

 Choose the old version here (in fact, the only difference between the old version and the new version is that the text component is somewhat different, and the others are not different)

 

 The above two pictures are the parameters of the most important input field (input area) component in the text input box

This is the text input 

The interactive (interactive) here is the same as the button. After selecting, we can enter text in the text input device and interact with the text input device. 

The transition and subsequent parameters are the same as the button, the change when it is selected, the change when it stays on it, etc. (the same is true for navigation)


 The above text parameter displays the text entered by the user

Generally, before we enter the text input box, there will be placeholder text in the box, such as "Enter text" as shown in the figure below

 The placeholder text can be modified, and this placeholder text is also a game object, which is a sub-object of the text input device

This is it

 placeholder

After we click on this text, there is only one text component in it

 We can make a series of modifications to the placeholder text in this component, and then once the user enters something in the text input box, the placeholder text will disappear


Back to our text input box component

Role limit parameter: refers to the maximum number of characters entered in the current text box

 

Content type parameter: It is to specify the type of content we input into the text input box 

If the type is a password, anything the user enters will be displayed as asterisks (but will not affect the user input itself)

The placeholder is used to set our placeholder text, and the frame is the game object used as the placeholder text

 These parameters are all settings for the cursor that has been blinking when we type

The selection color refers to the color displayed when the content in the text input box is selected, for example, this is the set green

 Don't care about the rest of the parameters

The next most important thing are these three boxes

 All three are events (events are added via the plus sign)

The first is the event called when the content in the text input box changes

Don't worry about the second one

The third one is the event executed when the editing is finished (press Enter to submit the content)

The way to add events (functions) is the same as button (button)

When accessing UI-related components, if it is an old version component, we need to introduce such a namespace

If it's a new version, it's this

 

 Take the declaration of the text input box object as an example

The above one is to declare an old version of the text input box object, and the bottom one is to declare a new version of the text input box object 

Guess you like

Origin blog.csdn.net/qq_51947882/article/details/126562865