Prototype Feature Keypad in VR - Unity3D

The Base

We'll develop a base and a few keypads just to showcase the object first before adding any scripts or VR features.


So far we have:
- A base created from a 3D cube

- Buttons (also from 3d base) with Text Mesh Pro ontop of it


Testing VR interaction

Next, I wanted to see if I can click on these buttons. 

First I added an audio source to each button and added a button click sound to the audio source.

Next for each button, I added a script that just plays the audio source when the function is called.

Finally, for each button, I added a Simple XR Interactable and on the select event, play the clicky sound.





Child / Parent Intearaction

Since each button has its own mind, I want the keypad itself to do the logic of the keypads. That is, each keypad button will tell the keypad that they've been pressed.

To do this we'll write a script:

For our keypad buttons, we'll call the parent and call a function:


For our keypad, we'll add it onto our passcode and print out what we added:



And it can be seen here:


Next steps include:

- Making a confirm into something happening button

- Making a wrong password reset

- Make a better keypad or finding one in the asset store.