Detailed Setup
QUICK START: You can add the Entire_Keypad_DemoScene to your scene and it will have all the keypad system setup and ready to use
Tag Setup:
Raycast:
3D keypad model should be tagged Keypad
Trigger:
3D keypad model should be set to Untagged
FPSController should be tagged Player
Detailed Setup:
1). Place the FPSController prefab in your scene from the Keypad System > Prefabs folder
On the MainCamera – Attach KeypadInteractor Script. (If not already).
Set the InteractDistance on the raycast script
You can set the KeypadTag here, by default it should be Keypad
Set the FPSController object to the tag of Player (Can be changed in the KeypadTrigger script)
Keypad UI Manager Setup:
2). Add the UIManager object into the hierarchy and add the following references:
Crosshair: Add the UI - Crosshair image from the child below
InteractPrompt: Add the UI - InteractPrompt from the child below
Keypad Input Fields: Add out of the UI - Type - InputFields from the children below
Keypad Type Canvas: Add the canvas' to the correct slot
Keypad Audio Manager
3). Add ONE AudioManager to the hierarchy:
Add the ScriptableObjects named:
SO_Denied_Tone
SO_Beep_Short and so on from the SOs folder
Keypad Disable Manager:
4). Add ONE Disable Manager to the hierarchy:
Make sure to add the FPSController object to this slot
Add the KeypadInteractor script (Which is on the main camera usually)
Check the Using different character controllers on the left bar for more information on changing this option
Input Manager Setup:
5). Add ONE InputManager - Make sure to set the inputs you'd like.
You can find the input handing inside the Keypad Raycast / Controller / Trigger scripts
6). You can choose to add one of the Raycast_Prefabs to your scene. (Please drag one of those out to the hierarchy! This should include: A keypad controller, keypad model, and various miscellaneous objects
Use the Raycast Prefabs if you want a First Person Interaction but the Trigger prefabs for a 3rd person or trigger style interaction!
Setting up 3D Keypad Model:
7). Open any of the Raycast or Trigger keypad collections and find the Keypad 3D model:
Set tag: Keypad (If using for a FirstPerson setup)
Has the KeypadItem script attached with the controller added to the slot
Has a Box Collider
KeypadController Setup:
8). Take a look at the Controller script for that set of objects - See settings below:
Keypad Type
Choose: Modern, Scifi, Keyboard, Bomb
Input Limit
Set character limit, based on the code you’ve just chosen
Code List
Set the array size to add more code options
Inside each option is a Keypad Codes to set the code you would like player to input
Then an event to activate when this code is input into the keypad
Keypad Interaction Sounds
Add the ScriptableObject objects from the corresponding folder
Keypad Input Sounds
Add the ScriptableObject objects from the corresponding folder
Trigger Event
Set whether this is a trigger event version by selecting the check box, if true. You will get another option to add the trigger object
Unlock Event:
I have added a Unity event call for when you get the code correct
Click the little + icon in the bottom right, it will add a new event and you can place any gameobject which may have a script with a public method you want to call.
In this case I have added the door object, this has a script called DoorController which has a public method called PlayAnimation
You can then run this code each time you unlock something, this can be changed on each door, and multiple events can happen in each! Making life really easy! (If you need any help do let me know)
Last updated