# How To Create a Key

<figure><img src="https://540954588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fpn2t9ISWRkG5tw4D8S4w%2Fuploads%2FyOVPljYvLyVBmNwFlLrV%2FKeysSingleObject.JPG?alt=media&#x26;token=daf75811-8058-4975-b44f-ecb32c252335" alt="" width="188"><figcaption></figcaption></figure>

### Creating Key ScriptableObject

{% hint style="info" %}

1. You can create a ScriptableObject by righting click the hierarchy and creating a **Key** object
   1. **Key Name:** Add the keys name here
   2. **Key Sprite:** Add the sprite to use for the key object
   3. **Key ID:** A unique indentifying number to be used as saving information for the inventory
      {% endhint %}

{% hint style="warning" %}
NOTE: Make sure all key scriptables are inside the **RESOURCES** folder, this will allowing the saving functionaity to work as intended.
{% endhint %}

<figure><img src="https://540954588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fpn2t9ISWRkG5tw4D8S4w%2Fuploads%2F6XfbqEoS2FwSuPyD5IwT%2FKeyScriptable.JPG?alt=media&#x26;token=e61f3adf-1105-40cd-9852-ed4a872340a4" alt=""><figcaption></figcaption></figure>

### Creating Key Collectable

{% 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)
2. **Key Collectable** script
   1. **KeyScriptable:** Add the relevant ScriptableObject to this slot
   2. **Pickup Sound:** 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%2FmXwbZYUiBB72b5ZzlWjP%2FKeyItem.JPG?alt=media&#x26;token=7a457db3-70be-4c36-a06d-152c93ec84bd" alt=""><figcaption></figcaption></figure>
