O'Reilly logo

Unity UI Cookbook by Francesco Sapio

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required