> For the complete documentation index, see [llms.txt](https://ilumisoft.gitbook.io/volume-control/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ilumisoft.gitbook.io/volume-control/how-to-use-the-volume-control-api.md).

# 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;
    }
}
```
