# Detailed Setup

## Quick Tips & Troubleshooting

{% hint style="info" %}
**QUICK START:** You can add the **Padlock Demo Scene Prefab** to your scene to get everything setup and ready to go without having to follow any extra steps.
{% endhint %}

### Layer Setup

{% hint style="info" %}
**CREATE LAYER:** Create a Layer in the top right of the Unity Inspector called **PadlockSpinner**
{% endhint %}

### FPS Controller usage

{% hint style="info" %}
When starting your new project you'll need to use a character controller you wish - I have included my **STFPSController** for ease of use
{% endhint %}

## System Setup

### Step 1 - Check the Padlock Prefab Spinner Layer

{% hint style="info" %}

1. Open the Padlock Spawnable objects from the prefabs folder and each spinner should be setup as below
   1. Padlock Spinner Setup:
      1. Make sure to add the **PadlockNumberSelector** script – Set the row according to it’s row
      2. **Box Collider**
      3. **Rigidbody**
      4. Set the Layer to **PadlockSpinner** (Make sure to create a Layer in the top right of the inspector called PadlockSpinner)
         {% endhint %}

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

### Step 2 - Player Setup

{% hint style="info" %}

1. Add the **FPSController** prefab from the p**refabs** folder to your scene. (You can drag this into the hierarchy or the main scene.)
   1. Set the **FPSControllers** layer to **Ignore Raycast** if you're having interaction issues with player colliders blocking the way
2. Main Camera Settings (Parented to the FPSController object)
   * Add the **PadlockInteractor** (If not already).
   * Set the tag to **MainCamera**
   * Add a **Physics Raycaster**
     * Set the **EventMask** to **PadlockSpinner**
       {% endhint %}

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

### Step 3 - Setting Up Trigger or Raycast Versions

{% hint style="info" %}

1. Add **PadlockTrigger / Padlock Raycast** sets to your hierarchy or scene from the assets Prefabs folder. Add this asset wherever you want in your scene.
   {% endhint %}

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

{% hint style="info" %}
2\. Make sure your **Padlock Interactable** GameObject has

1. **Box Collider**
2. **PadlockItem** script - Add the controller GameObject here (See below)
   {% endhint %}

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

### Step 4 - Padlock Controller Setup

{% hint style="info" %}

1. Select **Padlock Controller** object if not already added from the combined prefabs to your project, which will have the **PadlockController** script added
   {% endhint %}

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

{% hint style="info" %}
NOTE: Read through the information below and attach the correct GameObjects in the **PadlockController** script in the inspector. See the image on the next page for more details
{% endhint %}

| Type                                           | Description                                                                                        |
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| <p><strong>Your Combination</strong><br>  </p> | This is the code order you wish to open the padlock. 4 digits (1-9) only.                          |
| **InteractableLock**                           | Add the **Padlock\_Interactable** object to this slot                                              |
| **Prefab To Spawn**                            | This is the prefab from the spawnable prefabs folder that you wish to spawn in front of the camera |
| Distance From Camera                           | How far the padlock should spawn away from your camera                                             |
| Animation Name                                 | The animation name to play when opening the lock                                                   |
| **Audio Names**                                | The ScriptableObjects for all audio effects                                                        |
| **isPadlockTrigger**                           | Only tick this if you’re using a trigger event and have filled the above slot.                     |
| **Trigger Object**                             | Added your trigger event which would have the script **PadlockTrigger**                            |
| **Unlock Event**                               | You can add a gameobject with a script you want to activate when you get the code correct.         |

### Step 5 - Disable Manager Setup

{% hint style="info" %}

1. Drag a **DisableManager** - From the prefabs folder and you can start by adding new events for when the player should be enabled or disabled, see more inforomation on the page below.
   {% endhint %}

[Disable Manager Explained](/padlock-system-doc/getting-started/disable-manager-explained.md)

### Step 6 - Audio Manager Setup

{% hint style="info" %}
**AudioManager** - Add all of the appropriate ScriptableObject audio effects from the scriptableobjects folder
{% endhint %}

![](/files/eZSDB2TFNRNxEZ2OcTnj)

### **Setup 7 - Setup UI Manager**

{% hint style="info" %}
**UIManager** - This UI manager will have the canvas for all UI elements parented and you should add the correct UI elements to the slots in the manager.
{% endhint %}

![](/files/PQPQllBolC0EwFLZEYjC)

<figure><img src="/files/qn0TYNd17r5U5skxN8aE" 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/padlock-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.
