# Detailed Setup

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

{% hint style="info" %}
NOTE: You can get a quick start using the **Entire\_ThemedKey\_DemoScene** object and drag that straight into your scene. This will everyone to be already setup, you can delete the art assets as required but checkout the demo scene if you’re confused!
{% endhint %}

{% hint style="danger" %}
If you're using multiple puzzle assets from my store, check this page below for conflicts that you might come across and ways to fix them!
{% endhint %}

{% content-ref url="../support/using-multiple-puzzles" %}
[using-multiple-puzzles](../support/using-multiple-puzzles)
{% endcontent-ref %}

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

* Layer of: **Ignore Raycast**

**Any Interactable Object:**

* Tag **InteractiveObject** or as per the raycast script on the main camera, it will have the tag you need!
{% endhint %}

### Setting Up The Raycast

* When starting your new project please import an **FPSController** into your project. Add an **FPSController** prefab to your scene. (Unless you’re using the demo which will already have one added but the package will be required to be imported before use). You can add the **TKRaycast** script to either the main camera or the main player object.

![](https://2922797494-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJSpjZxMGZ9VZ4lJqz0D%2Fuploads%2FfdFwbJCnKp8DUkBQWixb%2FFPSController.JPG?alt=media\&token=33326ae0-9f48-4106-82ef-c358be7a32c5)

![](https://2922797494-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJSpjZxMGZ9VZ4lJqz0D%2Fuploads%2F2VsIGV8AwOFA24AE6er8%2FRaycast.JPG?alt=media\&token=876d977c-c182-42d6-8742-11c1f3b7ae79)

### Adding the Managers

* Now drag the (from the **Prefabs** folder into the hierarchy)
  * **TKUIManager**
  * **TKAudioManager**
  * **TKInventoryManager**

{% hint style="info" %}
**NOTE: Only drag this prefab into the hierarchy, not the scene.**
{% endhint %}

![](https://2922797494-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJSpjZxMGZ9VZ4lJqz0D%2Fuploads%2Fkxh6bTdVZ9p2U8l6REdv%2FManagers.JPG?alt=media\&token=6a9ceb74-b4ac-42e1-ab8e-5781075382b5)

### UI Manager Setup

* Select the **UIManager**, which will have the **TKUIManager** script and make sure all the items are connected as below:

<figure><img src="https://2922797494-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJSpjZxMGZ9VZ4lJqz0D%2Fuploads%2Fohl5tONZuklzH7Yw8HFp%2FUIManagerObject.JPG?alt=media&#x26;token=602c1b56-dbce-44bf-a6a4-842f185b5d25" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
All UI objects will be below this parent in the canvas
{% endhint %}

* Make sure to add the slots, crosshair and inventory canvas like is under the UIManager object

![](https://2922797494-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJSpjZxMGZ9VZ4lJqz0D%2Fuploads%2F8WAFYB7p8FD5nruLwXKn%2FUIManager.JPG?alt=media\&token=9793bf0a-9613-47de-b337-623800ce8ad7)

### Inventory Canvas Setup

* The Key Inventory Canvas is under the UI Manager

{% hint style="info" %}
The system uses a **CanvasGroup** on the main Canvas object which controls how to show and display the UI. It will fade the canvas in and out.
{% endhint %}



<figure><img src="https://2922797494-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJSpjZxMGZ9VZ4lJqz0D%2Fuploads%2FyqYbLZRZRqnxNsCR80AY%2FInventoryDesign.jpg?alt=media&#x26;token=a2311c9f-ac45-4b9b-bd3f-406c4b4f0ad3" alt=""><figcaption></figcaption></figure>

### Setting up the inventory

* Select the **TKInventory** – This item shouldn’t need editing at all, just make sure it’s on an empty gameobject

{% hint style="info" %}
We don't need to do anything with this script, it will be updated automatically!
{% endhint %}

![](https://2922797494-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJSpjZxMGZ9VZ4lJqz0D%2Fuploads%2FZLLRfPwAieBFdA1KeIAF%2FInventory.JPG?alt=media\&token=39de5a6d-8e48-4c02-90f1-cbaa1711d0c9)

{% hint style="info" %}
v1.5 now using a JSON save system and you can find more information [here](json-save-system)
{% endhint %}

### Setting up the Audio Manager

* Select the **AudioManager** and add the ScriptableObjects for sounds you will have created. (The ScriptableObjects folder will have some examples)

{% content-ref url="../support/adding-audioclips" %}
[adding-audioclips](../support/adding-audioclips)
{% endcontent-ref %}

![](https://2922797494-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJSpjZxMGZ9VZ4lJqz0D%2Fuploads%2FtOujpI65eZw2VzgXOxZr%2FAudioManager.JPG?alt=media\&token=1b6745ed-3b2c-4fdc-9f1d-b169f44bdf1b)

### Creating a Key Pickup

{% hint style="info" %}
You can add a key from the prefabs folder, all of the details should already be setup but check the details below to make sure.
{% endhint %}

* Tag: **InteractiveObject**
* Add a **Box Collider**
* Add a **TKItem** script to the object and set the **ItemType** to **Key**
* Add a **TKKeyCollectable** script and add the appropriate ScriptableObjects and your desired ScriptableObjects audio clip. (Found in the ScriptableObjects folder)

![](https://2922797494-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJSpjZxMGZ9VZ4lJqz0D%2Fuploads%2F7EFjxWVjeFZGV7F6iRvc%2FKey.JPG?alt=media\&token=ed573a6e-94f2-4679-8f20-f80cf832bb80)

### Creating an interactive door

{% hint style="info" %}
You can add a door from the prefabs folder, all of the details should already be setup but check the details below to make sure.
{% endhint %}

![](https://2922797494-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbJSpjZxMGZ9VZ4lJqz0D%2Fuploads%2FrHF49nrvly6a6mvhyeWK%2FDoor.JPG?alt=media\&token=12b5e6f5-1894-4118-a878-9989790d5bc4)

* Tag: **InteractiveObject**
* Make sure to add a **Box Collider**
* This object should have an **Animator** component
* Add a **TKItem** script to the object and set the **ItemType** to **Door**
* Add a **TKDoorInteractable** script and add the appropriate ScriptableObjects and settings:

|                      |                                                                                                                                                        |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Remove Key After Use | Should the key be removed from the inventory after using it with the door?                                                                             |
| Key Scriptable       | Add the key scriptable object that is specific for this door                                                                                           |
| Animated Door Key    | Add the animated key which is parented to this asset                                                                                                   |
| Sounds               | Add the sound SO's that are in the screenshot below                                                                                                    |
| Key Audio Delay      | The delay before the audio for key insert will play. Default: 0.5 seconds                                                                              |
| Door Open Delay      | The delay before the door opening sound will play. Default: 1.5 seconds                                                                                |
| Animation Event      | The event which happens when the key is inspired, so in my demo this plays the animation from the **TKDoorOpen** script which is on the prefab object. |
