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...

  1. To begin, we need to create our input field, right-click on the Hierarchy panel, ...

Get Unity UI Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.