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

* You can create a ScriptableObject by righting click the hierarchy and creating a **Key** object
  * **Key Name:** Add the keys name here
  * **Key Sprite:** Add the sprite to use for the key object

<figure><img src="https://540954588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fpn2t9ISWRkG5tw4D8S4w%2Fuploads%2FLAj5EkrrMZKISSkoAPNm%2FKeyImage.JPG?alt=media&#x26;token=8d21896b-4936-424f-86d5-53f255802832" alt=""><figcaption></figcaption></figure>

### Creating Key Collectable:

* 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%2FBVDUs3urkHUi6HQW1zYi%2FKeysObject.JPG?alt=media&#x26;token=268e9020-9a75-46a9-967d-d36b4524f9f0" alt=""><figcaption></figcaption></figure>
