This is a drag-and-drop Keypad / Passcode Prefab for VRChat worlds made in Unity 2019.4.29f for SDK3 with Udon. Using this prefab requires no coding from your part and is very easy to setup. Password and target door are both easily configurable. The keypad also has a small API for more advanced users, which can be used alongside custom scripting if more advanced behaviour is desired. The API documentation can be found below.
Note: If you are working with a legacy project, please migrate the project to the Creator Companion.
Download the Keypad .unitypackage
from the latest release.
In Unity: Drag the Keypad prefab into your world.
The prefab can be found in Assets\Resources\Foorack\Keypad
.
This is the Keypad
script located on the Keypad prefab object.
-
Door Object
accepts any GameObject. The linked object will be set active or inactive depending on if the entered passcode was right or wrong. -
Solution
is where you specify what the passcode / password will be. It accepts any numeric code up to 8 digits. -
Allow List
is an optional list of usernames that will always be allowed no matter what code they enter. -
Hide Door On Granted
When the correct passcode is entered it will either hide or show the door object. -
Disable Debugging
will make the keypad less verbose in the console. Feel free to disable it if you want! -
Additional Solutions
are additional codes that will also be accepted. By default all the codes will unlock all the doors. If you have more than one door object you can link them inAdditional Door Objects
. -
Key Separation
is an alternative mode which requires you to have the same amount of solutions as doors. When enabled it pairs each solution to its own unique door. This means solution 1 will only open door 1, solution nr. 2 will open door 2, etc.Solution
pairs withDoorObject
in this mode.
If you have any problems, please feel free to reach out on Discord! I'm always willing to help with any Keypad-related issues!
This Keypad supports many customization features. For example translating the Keypad into your own language, by changing the status texts. You can also change the values of the buttons to letters, add more buttons (make a whole keyboard if you want!), change the design, etc. they're just Unity cubes after all. People have made some really pretty keypads over the years! You can see pictures of them in the discord server.
This is optional, and only recommended for people who are interested in doing Udon programming.
There are three callbacks which are sent via SendCustomEvent
to the UdonBehaviour
referenced in the fields Program Closed
, Program Denied
, and Program Granted
. If you wish to listen to all the callbacks on one UdonBehaviour
you'll need to link it in all three slots.
You can optionally declare a string variable named keypadCode
. This will be set via SetProgramVariable
and contains the code that was entered by the user.
UdonBehaviour | Event Name | Description |
---|---|---|
programGranted | "keypadGranted" | Runs at correct code |
programDenied | "keypadDenied" | Runs at wrong code |
programClosed | "keypadClosed" | Runs at pressing Clear/CLR |
Feel free to use this prefab without crediting either me (KitKat) or Foorack (the original creator). But if you do use it, I would love it if you sent a picture of it in use in the discord server! It really gives me motivation to update and improve this prefab, as well as continue making other stuff. Thank you!