# How to use the Volume  Control API

If you need to access the different volume levels in a script, just import the **Ilumisoft.VolumeControl** namespace and set or get the appropriate **Volume** property of a group as shown in the example below:

```
using Ilumisoft.VolumeControl;
using UnityEngine;

public class VolumeExample : MonoBehaviour
{
    private void Start()
    {
        //Sets the master volume to 100%
        VolumeControl.Master.Volume = 1.0f;

        //Sets the music volume to 50%
        VolumeControl.Music.Volume = 0.5f;

        //Sets the sound effect volume to 25%
        VolumeControl.SFX.Volume = 0.25f;
    }
}
```

To mute or unmute a group, set the **IsMuted** property to true or false:

```
using Ilumisoft.VolumeControl;
using UnityEngine;

public class MutingExample : MonoBehaviour
{
    private void Start()
    {
        //Mutes all sounds
        VolumeControl.Master.IsMuted = true;

        //Mutes only music
        VolumeControl.Music.IsMuted = true;

        //Mutes only SFX
        VolumeControl.SFX.IsMuted = true;
    }
}
```


---

# 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://ilumisoft.gitbook.io/volume-control/how-to-use-the-volume-control-api.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.
