# Detailed Setup

## Quick Tips & Troubleshooting

{% hint style="info" %}
**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&#x20;
{% endhint %}

### TextMeshPro Required

{% hint style="info" %}

* Please note that TMP will appear as a popup if not installed in your project
* Click **Import TMP Essentials** to use the system fully
  {% endhint %}

### Tags Reference Guide

{% hint style="info" %}

* **Raycast:**&#x20;
  * 3D keypad / phone model should be tagged: **Keypad**
* **Trigger:**&#x20;
  * 3D keypad model should be set to: **Untagged**
  * FPSController should be tagged: **Player**
    {% endhint %}

## System Setup

### Step 1 - Player Setup

{% hint style="info" %}

1. Place the **FPSController** prefab in your scene from the **Prefabs** folder
   1. Set the **FPSController** object to the tag of **Player**
2. On the **MainCamera** – Attach **CodeDeviceInteractor** Script. (If not already).
3. CodeDeviceInteractor Settings:
   1. Set the **InteractDistance** (Default: 5)
   2. Set the **DeviceTag** (Default: CodeDevice)
   3. Set the **InputKey** (Default: E - [Uses the older input system](/keypad-system-doc/support/where-are-inputs.md))
      {% endhint %}

<figure><img src="/files/nmrZTgQzJZlRYo6FM67E" alt=""><figcaption></figcaption></figure>

### Step 2 -  UI Manager Setup

{% hint style="info" %}

1. Add the **UIManager** object into the hierarchy and add the following references
   {% endhint %}

|                                |                                                                    |
| ------------------------------ | ------------------------------------------------------------------ |
| Keypad Input Fields (CodeText) | Add out of the **UI - Type - InputFields** from the children below |
| Canvas References              | Add the canvas' to the correct slot                                |
| Raycast Interact Prompt        | Add the **UI - InteractPrompt** from the child below               |
| Trigger Interact Prompt        | Add the **UI**                                                     |
| Crosshair                      | Add the **UI**                                                     |
| Persist Across Scenes          | Tick this box if you want this manager to stay between scenes      |

<figure><img src="/files/vTXZn5HIdPoarqjNioxu" alt=""><figcaption></figcaption></figure>

#### UI Manager Objects

<figure><img src="/files/VvPWUuI0PnxAjwgK7DrR" alt=""><figcaption></figcaption></figure>

### Step 3 - Keypad Audio Manager

{% hint style="info" %}

1. Add ONE **Audio Manager** to the hierarchy
2. Add the ScriptableObjects named
3. If you need more help on creating new audio ScriptableObjects:&#x20;

[Adding New Audioclips](/keypad-system-doc/managers-explained/adding-new-audioclips.md)
{% endhint %}

<figure><img src="/files/5OiAvG3kDzfDx2qVqx7V" alt=""><figcaption></figcaption></figure>

### Step 4 - Disable Manager

{% hint style="info" %}

1. Click the "**+**" on either the **OnPlayerDisabled()** or **OnPlayerEnabled()** to add new events
2. I disable the **FirstPersonController** script by selecting the **FirstPersonController > Bool Enabled**&#x20;
3. I disable the **CodeDeviceInteractor** when the player is disabled
4. I actually enable the **CodeDeviceUIManager.ShowCrosshair**
   {% endhint %}

{% content-ref url="/pages/Oqw3ZapjGfrtMmTEM8mA" %}
[Disabling Player](/keypad-system-doc/managers-explained/disabling-player.md)
{% endcontent-ref %}

<figure><img src="/files/TZvGfmmlbMu6aq9bZI8y" alt=""><figcaption></figcaption></figure>

### Step 5 - Setting up 3D Keypad Model

{% hint style="info" %}

1. Open any of the Raycast or Trigger keypad collections and find the Keypad 3D model
2. Set tag: **DeviceCode** (If using for a FirstPerson setup)
3. Has the **DeviceCodeItem** script attached with the controller added to the slot
4. Has a **Box Collider**
   {% endhint %}

![](/files/Oiic3owAWtOwzafhMyNH)

### Step 6 - Keypad / Phone Controller Setup

{% hint style="info" %}

1. Add a Keypad / Phone controller to any empty gameobject or similar
2. Take a look at the **Controller** script for that set of objects - See settings below
   {% endhint %}

<figure><img src="/files/DZiEFzZVrCi76rUj8S9C" alt=""><figcaption></figcaption></figure>

| **Keypad Type**               | Choose: Modern, Scifi, Keyboard, Bomb                                                                                                                                                                                                         |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Input Limit**               | Set character limit, based on the code you’ve just chosen                                                                                                                                                                                     |
| **Code List**                 | <ul><li>Set the array size to add more code options</li><li>Inside each option is a <strong>Codes</strong> to set the code you would like player to input</li><li>Then an event to activate when this code is input into the keypad</li></ul> |
| Closing Input                 | This is the input used to close 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                                                                                                        |

### Step 7 - Unlock Event:

{% hint style="warning" %}

* Click the **+** 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.&#x20;
* In this case I have added the door object, this has a script called **DoorController** which has a public method called **OpenDoor**
* 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
  {% endhint %}

{% content-ref url="/pages/xTyR8IaJIc0w4P8yjDnf" %}
[Unlock Event](/keypad-system-doc/support/unlock-event.md)
{% endcontent-ref %}

<figure><img src="/files/9Ugw2dDQnpPLIcWxVtoh" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://speedtutoruk.gitbook.io/keypad-system-doc/getting-started/main-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
