Built a Multi-Digit PIN Pad in Unity

Josh Watts
2 min readOct 23, 2022

--

In this article we can create a pin pad that will check to see if we have entered in our secret pin. The enter pin at the top is just a text field and the rest are buttons. On all the buttons we will put one script which we can call Pin number script. First we need our variables and our first method.

Our text box will be the text at the top of our pin pad. Our entered number will store the pin we are typing in. The hidden pin will be our password, we will check this in a method when we click on enter. The first method will be called with an on click event and we will pass in a string that corresponds to the number we clicked on.

Then we need to check if we entered the secret pin with an onclick event on our enter button.

If we made a mistake and we want to clear, we can hit the clear button.

Here it is in action with a secret pin of 1111.

--

--

Josh Watts

Hello I am an aspiring game developer learning to develop great games. Right now I am going through a program with GameDevHQ. My favorite game is Half-Life.