Making an input field for a password with a lower bound limit for characters
Sometimes, a password cannot be shorter than a lower bound character limit. This happens for a lot of reasons, including security. In Unity, we can easily set an upper bound limit for characters by specifying it in the Input Field (Script) component inside the Character Limit variable. In this recipe, what we are going to achieve is the checking of lower bound limits for characters in input fields. So, you will learn how to write a short script to handle this, and as a consequence, the input field will also be reset. This means an empty string is assigned to the text
variable.
How to do it...
To begin, we need to create our input field, right-click on the Hierarchy panel, then go to UI | Input Field, and rename it myInputField. Finally, place it wherever you want.
As we discussed in the introduction to this recipe, we are going to create a password input field. We should also select Password in the drop-down menu of...