# Detailed Setup

## Quick Tips & Troubleshooting

{% hint style="info" %}
**QUICK START:** You can add the **Door Kit - Demo Scene - Prefab** to your project, to get a quick start with every part connected.&#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 %}

### Door Prefab Rotation

{% hint style="info" %}

* Some door objects may appear flat when dragged from the prefabs folder
  * **Set X rotation to -90 to fix this issue**
    {% endhint %}

## System Setup

### Step 1 - Setting Up The Player

{% hint style="info" %}

1. Make sure you have a **FPSController**
2. Add a **DoorInteractor** script (This may be on the Main Camera already)
   1. **Ray Distance:** This is how far you can interact with objects
   2. **Interaction Key:** What key should we use for interaction clicks. **Default: Mouse 0**
      {% endhint %}

<figure><img src="https://540954588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fpn2t9ISWRkG5tw4D8S4w%2Fuploads%2FH8ALO2pONZ5GLQwjdoEc%2FDoorInteractor.JPG?alt=media&#x26;token=f9909319-9e35-4a3e-8637-07de94a998e6" alt=""><figcaption></figcaption></figure>

### Step 2 - Door Inventory Setup

{% hint style="info" %}

1. Add a **DoorInventory** object from the prefabs folder (Details are explained below)
   {% endhint %}

|                   |                                                                                                                                                                                                                            |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Inventory Key** | What key press do we need to open the inventory                                                                                                                                                                            |
| **Key List**      | Will fill when you collect object (Leave blank)                                                                                                                                                                            |
| **Key Events**    | You can add the **Door UI Manager** to both slots and find the method (At the top of the list) for **AddInventorySlot** & **RemoveInventorySlot** to the respective area                                                   |
| **Persistence**   | <ol><li>Choose whether you want this object to save between scenes</li><li>Whether you want to enable automatic saving (Remember all Key ScriptableObjects need to be in the resources folder to save correctly)</li></ol> |
| **Debugs**        | Using the custom editor buttons will allow you to check for a saved file, delete it or search the location for a saved file                                                                                                |

{% hint style="info" %}
Details about the [JSON Saving system](https://speedtutoruk.gitbook.io/door-interaction-kit-doc/managers-explained/json-save-system) can be found on the page linked
{% endhint %}

<figure><img src="https://540954588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fpn2t9ISWRkG5tw4D8S4w%2Fuploads%2FYAoSNa52lZJYhN8Pp66t%2FDoorInventory.JPG?alt=media&#x26;token=76400d1e-39b1-4dc4-86e0-6b6acc8d5232" alt=""><figcaption></figcaption></figure>

### Step 3 - Door UI Manager Setup

{% hint style="info" %}

1. Add a **DoorUIManager** object from the prefabs folder (If not already added & Details are explained below)
   {% endhint %}

|                                           |                                                                                                                                                                                                                                                                                                                               |
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Object Interaction Prompts**            | <ul><li><strong>InteractTextBG:</strong> UI background for interaction text</li><li><strong>Interaction UI:</strong> UI interactionnametext object</li><li><strong>IconImage:</strong> UI - Icon that can be displayed</li><li><strong>KeyPromptUI:</strong> For the key prompts when collecting, using or removing</li></ul> |
| **Notification UI**                       | <ul><li><strong>NotificationTextUI:</strong> Notification TextMeshPro gameobject from the UI</li><li><strong>NotificationUIBG:</strong> The background UI object</li></ul>                                                                                                                                                    |
| **Notification UI - Text Customisation:** | Set the size, type, style and colour                                                                                                                                                                                                                                                                                          |
| **Inventory Fields**                      | <ul><li>Add the Inventory slot prefab from the prefabs folder</li><li>Add the Inventory Panel UI object</li><li>Fading duration when opening and closing the inventory</li></ul>                                                                                                                                              |
| **Timer**                                 | The timers for showing the popup UI of notifications on screen                                                                                                                                                                                                                                                                |
| **Crosshair U**                           | Add the Crosshair UI here                                                                                                                                                                                                                                                                                                     |

<figure><img src="https://540954588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fpn2t9ISWRkG5tw4D8S4w%2Fuploads%2Fzg9VwSbWxPyh2Nsr5cvM%2FDoorUIManager.JPG?alt=media&#x26;token=11ac3269-0493-4634-bba0-629337d71855" alt=""><figcaption></figcaption></figure>

### Step 4 - Door Audio Manager Setup

{% hint style="info" %}

1. Add a **Door Audio Manager** object to your scene (If not already)

You can add the Sounds - ScriptableObjects to this to make them playable
{% endhint %}

{% hint style="info" %}
More information on [Audio Scriptables here](https://speedtutoruk.gitbook.io/door-interaction-kit-doc/managers-explained/audio-scriptableobjects)
{% endhint %}

<figure><img src="https://540954588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fpn2t9ISWRkG5tw4D8S4w%2Fuploads%2F4f7XqT8mBo56kmEBJZqd%2FDoorAudioManager.JPG?alt=media&#x26;token=271c3ead-9052-467c-823d-30b19fff7369" alt=""><figcaption></figcaption></figure>

### Step 5 - Adding Doors

{% hint style="info" %}

1. Add a **Door** object to your project - This will require the following components
   1. Box Collider
   2. **InteractablePrompt** script (Optional Component)
   3. **DoorInteractable** script
      {% endhint %}

### Step 5.1 - Interactable Prompt Settings (Optional Component)

{% hint style="info" %}
More information on the Interactable Prompt [here](https://speedtutoruk.gitbook.io/door-interaction-kit-doc/getting-started/interactable-prompt)
{% endhint %}

|                                  |                                                                                                                         |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| **Enable Prompt**                | Whether you want to interact prompt to show                                                                             |
| **Icon Parameters**              | Enable whether you want to show the icon from the UI manager                                                            |
| **Key Prompt Parameters**        | <ul><li>Whether you want to show the KeyPromptText</li><li>Add text below to prompt for the player</li></ul>            |
| **Interaction Name Parameters:** | <ul><li>Whether you want to show some kind of interaction text</li><li>Add the interaction text to this field</li></ul> |

<figure><img src="https://540954588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fpn2t9ISWRkG5tw4D8S4w%2Fuploads%2FcHdUIv8w0QJIC7YD26A1%2FInteractablePrompt.JPG?alt=media&#x26;token=b7c5e876-f8a6-4f30-978c-a249f949028f" alt=""><figcaption></figcaption></figure>

### Step 5.2 - DoorInteractable Settings

|                       |                                                                                                                                                                                |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Interactable Type     | Select a Door or Drawer                                                                                                                                                        |
| Door Transform        | Add the door to this slot here or the pivot point (If you're using a parent object)                                                                                            |
| Door Opening Settings | Set the angle, axis, speeds for opening and closing                                                                                                                            |
| Sound Delay Settings  | Add the sounds scriptable objects and delay the audio if you like                                                                                                              |
| Plank Settings        | If you want to use planks over the doors to block it. Show it and set how many are above (Adding 1 or more to the plank count will make this become active)                    |
| Lock Settings         | <ul><li>Choose whether to enable locking, set the text to appear via notification for when this is locked or unlocked. </li><li>Choose to remove the key and the SO</li></ul>  |
| Spawning Items        | Choose an item you want to appear at a spawn location - More information [here](https://speedtutoruk.gitbook.io/door-interaction-kit-doc/getting-started/how-to-spawn-objects) |

<figure><img src="https://540954588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fpn2t9ISWRkG5tw4D8S4w%2Fuploads%2F4dTDV8jYLrksrwMIFQaE%2FDoorInteractableScript_V1.2.JPG?alt=media&#x26;token=3361c7c5-f001-45e8-8daf-991e0604458d" alt=""><figcaption></figcaption></figure>

### Step 6 - Creating Keys

{% hint style="info" %}

1. Add a 3D object of a key to your scene and make sure it is setup as below:&#x20;
   1. **Box Collider**
   2. **InteractablePrompt** script (Optional Component)
   3. **Key Collectable** script
      1. **KeyScriptable:** Add the relevant ScriptableObject to this slot
      2. **PickupSound:** Add a pickup sound of your choice
         {% endhint %}

<figure><img src="https://540954588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fpn2t9ISWRkG5tw4D8S4w%2Fuploads%2F53xAH3cjYsCFflU87B1n%2FKey.JPG?alt=media&#x26;token=87f4b328-d60c-4a69-9a68-a7b541e507ce" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
More information can be found on [this page](https://speedtutoruk.gitbook.io/door-interaction-kit-doc/getting-started/how-to-create-a-key)
{% endhint %}

### Step 7 - Spawning Objects

{% hint style="info" %}
**Spawning Objects Suggestion:**

Spawning items in drawers, make sure the drawer has a mesh collider because you don't want another collider blocking the interaction

* Box Colliders have a larger area and can block more precise interactions
* Box colliders are good for general interactions&#x20;
* Mesh colliders are more expensive but required when doing things like items in drawers
  {% endhint %}

{% hint style="warning" %}
You can find more information on [setup here](https://speedtutoruk.gitbook.io/door-interaction-kit-doc/getting-started/how-to-spawn-objects)
{% endhint %}
