> For the complete documentation index, see [llms.txt](https://docs.cgpoly.io/door-system-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cgpoly.io/door-system-documentation/advanced/components/smartkey.md).

# SmartKey

### Core Features <a href="#core-features" id="core-features"></a>

#### Key Identification <a href="#key-identification" id="key-identification"></a>

Each instance of `SmartKey` can be uniquely identified or described through the `keyName` property. This could be used for various purposes like showcasing the name of the key to the player, or to determine game-rules based on the different keys.

#### Door Unlock Mapping <a href="#door-unlock-mapping" id="door-unlock-mapping"></a>

Each `SmartKey` object maintains a list of `SmartDoor` objects that it can unlock. This is maintained in the `unlockDoors` property. Assign `SmartDoor` objects to this array to establish doors that the key can interact with.

### Usage <a href="#usage" id="usage"></a>

Attach the `SmartKey` component to any GameObject, ideally this would be a GameObject that visually represents a key in the game. The key can then be configured to dictate which `SmartDoor` objects it can interact with, through the `unlockDoors` property. This level of control in the hands of the developer allows for varied game mechanics and puzzles by determining the interaction between specific keys and doors.

![Smart Key Component](https://charley3d.github.io/doorsystem/images/smarkeyComponent.png)

#### Key Name <a href="#key-name" id="key-name"></a>

This is a string property where you can define the name of the key. This name might be used for display in a UI, or for debugging and identification purposes within the Unity Editor.

#### Unlock doors <a href="#unlock-doors" id="unlock-doors"></a>

This is an array of SmartDoor objects that represents specific doors this key can unlock or operate. By setting up different keys to interact with different sets of doors, you can manage access and player progression in your game.
