This is a drag-and-drop Keypad/Passcode Prefab for VRChat worlds made in Unity 2019.4.31f1 and SDK3 with Udon. This prefab requires no coding from your part and is very easy to setup. Password and target door are both easily configurable, with optional support for custom activation scripts if wanting more advanced functions.
There are many ways of customizing the keypad, from many options, audio feedback, automatic granting, teleport on grant, changing the text displayed, easily customizable UI, expandable features via the program relays, remote string loading, etc! There is also extensive debugging done with the logs to allow easy understanding of its behaviour and fast support in case you encounter an issue.
Note: The Keypad has been rewritten into UdonSharp. Don't worry! You don't have to touch UdonSharp code I promise!
- Make sure you have UdonSharp 1.1.7 or higher installed via the VCC (Projects > Manage project > Plus icon on the right of Udonsharp)
- Download & Import the keypad into your project
- Enjoy?
Settings: Look at the settings provided on the main Keypad object:
The main focus is "Door Objects" (marked in green) which accepts any GameObject and will toggle active status depending on passcode status, and "Solution" (marked in yellow) which accepts any numeric passcode up to 8 numbers long.
"Allow List" means the usernames on that list will always be allowed no matter what code they press or no code at all. "Deny List" means those users will never be allowed, even if they type the correct code.
"Additional Solutions" are additional codes that will also be accepted, and will unlock all doors. "Additional Door Objects" is a way to provide if you have more than 1 door object, and you want to open them all at the same time.
"Key Separation" is a special 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 open only door 1, solutions 2 will open only door 2, etc...
The Keypad supports translating the display output, custom characters to replace the numbers, and many more things!
This is optional, and only recommended for people who are interested in doing Udon programming. You should at least have watched Tupper's tutorial on cube-rotation before attempting this!
There are 3 possible events sent at different stages: at success, at failure, and at reset. Each referenced UdonBehaviour will receive one of the events described. An optional variable keypadCode
will be set with the entered code on the target program.
You are free to use this prefab as you wish as long as you don't claim it as yours, republish as is, or resell. But if you do use it, I would love it if you sent a quick screenshot or credit. It really gives motivation to continuously update and improve this, as well as continue making other stuff public. Thank you!