Unity : Simple keypad for a door or safe (walk-through + with download ) - Part 1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
how's it going guys welcome back to another tutorial that I'll be showing you my simple keypad that I created in unity and I will be leaving a link to download this project in the description of this video so feel free to do that but I also want to take you through all the functionalities and what you can change on this keypad to basically work for your game to take you through how it works I just click this I'm gonna pull up a little keypad under the pulpits 1 2 3 so if I enter in something wrong like 1 4 5 this makes that error sound if I enter in 1 2 3 which is the correct password just at the moment displays correct password but you can obviously change this to whatever you like for example you can trigger an animation to open up a door or safe or what I was using it for and one of my other games was to basically move to the next scene there's also a clear function so clear and this is just a quick cool so let me take you through how it all works so the first thing I'm going to show you guys is the keypad prefab so what you can actually do is I've made it very flexible where you can change the numbers to letters or symbols so for example we can change the text to a if I save that we didn't also want to change the text on the canvass keypad so this is what we're actually going to be entering in so if I click on the button text you can change that to a and then on the button itself you'll see this little section here or you can change where it's requiring up value entered so we're just change it to a so just disable disable that and run you can see it now displays a it's obviously it's been very positive not gonna work but yeah you can see you can change this to whatever you like letters symbols you can add more buttons whatever you like to take ok so to take you through the script you just I look like I have this up cool so start you up at the top we've got objects disabled so this is just the floating the floating joystick and the slaughter that we disabling when we click on that game objects then object enables obviously the keypad here so then have a couple settings for the keypad so your password which you can set in your game those are just playing the password there is a display in the pasta to that text area that was on the keypad and this is just the sound you hear when you enter in there incorrect password then on the starts just setting these two defaults this number of guesses is the length of your password where needs to equal each other you can see in updates if these two equal each other so the button clicks this obviously increments every time you add a letter so if we collect a this will go to 1 if we clicked a again so it's a a this will be 2 2 if we yeah so if it increments and then if the button clicks is that equal to the length of the password reaches 3 then we do this logic here 3 obviously check to see if what has been input as equal to the password it is then we do some logic here so you can see how just at the moment is displaying correct password but from our previous game that I was using this for I was moving it to the next scene you can almost a chain just activates animation or something like this yeah you do whatever you like and if the part isn't correct you can see we just reset everything and we play that sound so this part it's just that when we click on that keypad that's on the door we're just doing some ray casting um and we're just checking comparing the tags see if it's a keypad which it is that game object is a game object on that keypad that's got a box colada and I've changed the tag to keypad once and we just set this keypad screen to true and then if it's true we just hide those fields the joystick and the slaughter and we enable the keypad on the on the canvas so this value entered this is what we saw on those buttons where we pass we change that one to a so the the variable comes through here we just do a case statement if it's Q or C which was the quitzel clear we just do some logic here so it's pretty straightforward to follow and then the defaults if it's anything other than Q and see basically we basically increment this button clicked and we just we add whatever value was entered into our inputs so it's just boses string up and we just play whatever was entered and yeah that's pretty much it yeah so I hope this is useful guys if you have any questions or anything just let me know and please leave a like and subscribe cool thanks for watching [Music]
Info
Channel: CatoDevs
Views: 9,200
Rating: undefined out of 5
Keywords: unity tutorial, keypad, keycode, simple keypad, simple keycode, unity, in unity, how to, how to create a keypad, how to create a keycode, simple tutorail, download keypad, make a keypad, keypad for door, keypad for safe, simple, tutorial, key pad, key code, unity keypad, unity how to make a keypad, c#, 2020, coding, keypad prefab, safe keypad, door keypad, creating a keypad, how to create, how to code, open a door using a keypad, youtube, download in the link, download, easy to
Id: hWQ7Jvx6Ils
Channel Id: undefined
Length: 5min 26sec (326 seconds)
Published: Sat May 23 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.