# Quick Setup

{% embed url="https://youtu.be/1vJ1JHbQ_Dw" %}

{% hint style="info" %}
**QUICK START:** You can add the **DoorInteractionKit\_Full\_DemoScene** to your project, to get a quick start with every part connected.&#x20;
{% endhint %}

{% hint style="info" %}
#### Door Rotation:

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

{% hint style="info" %}
#### Remember:&#x20;

* The asset uses TextMeshPro (TMP) - Make sure this is added to your project
{% endhint %}

1. Make sure you have a **FPSController**

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

<figure><img src="https://540954588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fpn2t9ISWRkG5tw4D8S4w%2Fuploads%2FfZxfdhY0LY14hkyLHR8B%2FDoorInteractor.JPG?alt=media&#x26;token=8da958c1-0654-496f-b523-34955d4565ed" alt=""><figcaption></figcaption></figure>

### Adding Managers

2. Add a **DoorInventory** object from the prefabs folder:

* **Inventory Key:** What key press do we need to open the inventory
* **Key List:** Will fill when you collect object (Leave blank)

<figure><img src="https://540954588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fpn2t9ISWRkG5tw4D8S4w%2Fuploads%2FVyCJo28BtEp8aPZijgWz%2FDoorInventory.JPG?alt=media&#x26;token=225594c4-9de2-4910-865e-a3edcdc49f25" alt=""><figcaption></figcaption></figure>

3. Add a **DoorUIManager:**&#x20;

* **Object Interaction Prompts:**&#x20;
  * **InteractTextBG:** UI background for interaction text
  * **Interaction UI:** UI interactionnametext object
  * **IconImage:** UI - Icon that can be displayed
  * **KeyPromptUI:** For the key prompts when collecting, using or removing
* **Notification UI:**&#x20;
  * **NotificationTextUI:** Notification TextMeshPro gameobject from the UI
  * **NotificationUIBG:** The background UI object&#x20;
* **Notification UI - Text Customisation:**
  * Size of the notification&#x20;
* **Inventory Fields:**&#x20;
  * Inventory slot prefab
  * Inventory Panel UI object
  * Fading duration when opening and closing the inventory
* **Timer:** The timers for showing the popup UI of notifications on screen
* **Crosshair UI:** 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>

4. Add a **DoorAudioManager**

* You can add the Sounds - ScriptableObjects to this to make them playable

<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>

### Adding Doors

5. Add a **Door** object to your project:

* Box Collider
* **DoorItem** script
  * **EnablePrompt:** Whether you want to interact prompt to show
  * **Icon Parameters:**&#x20;
    * Enable whether you want to show the icon from the UI manager
  * **Key Prompt Parameters:**&#x20;
    * Whether you want to show the KeyPromptText&#x20;
    * Add text below to prompt for the player
  * **Interaction Name Parameters:**
    * Whether you want to show some kind of interaction text
    * Add the interaction text to this field
  * **Item Type:** Set this to the door type you wish to use

<figure><img src="https://540954588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fpn2t9ISWRkG5tw4D8S4w%2Fuploads%2FNOZ5ZOVAgfe33xLriOGY%2FDoorItem.JPG?alt=media&#x26;token=15efa4b4-ed96-496d-8f22-e740bb583661" alt=""><figcaption></figcaption></figure>

* **DoorInteractable** script
  * Interactable Type: Select a Door or Drawer
  * Door Transform: Add the door to this slot here
  * 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
  * Lock Settings:&#x20;
  * Spawning Items:&#x20;

<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>

### Add your Canvases

* Crosshair Canvas
* Door Inventory Canvas
* Text Prompts Canvas

<figure><img src="https://540954588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fpn2t9ISWRkG5tw4D8S4w%2Fuploads%2FjBWoTontYl60woyt7l9u%2FUICanvases.JPG?alt=media&#x26;token=4dc182b3-14ee-4bfd-91e6-3104a4a4d0a5" alt=""><figcaption></figcaption></figure>

### Creating Keys

Add a 3D object of a key to your scene and make sure it is setup as below:&#x20;

* **Box Collider**
* **Door Item** script
  * Set the DoorType to Key
* **Key Collectable** script
  * **KeyScriptable:** Add the relevant ScriptableObject to this slot
  * **PickupSound:** Add a pickup sound of your choice

<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](how-to-create-a-key)
{% endhint %}

### 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](how-to-spawn-objects)
{% endhint %}
