# Audio ScriptableObjects

## Adding Audioclips

{% hint style="info" %}

1. ScriptableObjects for audio can be created by **Right Clicking anywhere in the project panel > Create > Sound** or duplicating an already created SO.
   {% endhint %}

<figure><img src="/files/d2foWZBZyQPPRzXOxo6W" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
2\. ScriptableObjects will all have specific settings that control the audio clip which is used, that you can change, the volume, pitch, variance and whether it can loop. All features of the default **AudioSource** component.
{% endhint %}

<figure><img src="/files/lAmK2Wvzi5IvoW1MZSkm" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
In the **AudioManager** is good to add the size of the **Sounds** array to the number of sounds which will play within this system. By default it has 3 SO audio clips, these should be added to access them all.
{% endhint %}

<figure><img src="/files/GEBIQwSu9VgSdVCZpxOn" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Look at the inspector of the **DoorInteractable / KeyCollectable / PlankInteractable** script and this will have slots for specific SO sound effects that you can add! This allows you to play that specific SO from the audio manager.
{% endhint %}

## **Referencing the Audio Manager**&#x20;

{% hint style="info" %}
Use the code, within your scripts to reference your sounds to play.&#x20;
{% endhint %}

```csharp
//This code will play the references ScriptableObject sound effect
DoorAudioManager.instance.Play(VariableName);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://speedtutoruk.gitbook.io/door-interaction-kit-doc/managers-explained/audio-scriptableobjects.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
