> For the complete documentation index, see [llms.txt](https://sonity.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sonity.gitbook.io/docs/soundtrigger/soundtrigger-functions.md).

# SoundTrigger Functions

Reference of all the SoundTrigger functions

### Play

```csharp
// Plays the SoundEvent at the position of the owner Transform
public void Play();
public void Play(SoundTag localSoundTag);
public void Play(params SoundParameterInternals[] soundParameterInternals);
public void Play(SoundTag localSoundTag, params SoundParameterInternals[] soundParameterInternals);
```

<table><thead><tr><th width="213.933349609375">Parameters</th><th></th></tr></thead><tbody><tr><td>localSoundTag</td><td>The <a href="/docs/soundtag.md">SoundTag</a> which will determine the Local <a href="/docs/soundtag.md">SoundTag</a> of the <a href="/docs/soundevent.md">SoundEvent</a></td></tr><tr><td>soundParameterInternals</td><td>For example <a href="/docs/soundparameter.md">SoundParameterVolumeDecibel</a> is used to modify how the <a href="/docs/soundevent.md">SoundEvent</a> is played</td></tr></tbody></table>

### PlayAtPosition

```csharp
// Plays the SoundEvent at the Vector3 position with another Transform as the owner
public void PlayAtPosition(Vector3 position);
public void PlayAtPosition(Vector3 position, SoundTag localSoundTag);
public void PlayAtPosition(Vector3 position, params SoundParameterInternals[] soundParameterInternals);
public void PlayAtPosition(Vector3 position, SoundTag localSoundTag, params SoundParameterInternals[] soundParameterInternals);

// Plays the SoundEvent at the Transform position with another Transform as the owner
public void PlayAtPosition(Transform position);
public void PlayAtPosition(Transform position, SoundTag localSoundTag);
public void PlayAtPosition(Transform position, params SoundParameterInternals[] soundParameterInternals);
public void PlayAtPosition(Transform position, SoundTag localSoundTag, params SoundParameterInternals[] soundParameterInternals);
```

<table><thead><tr><th width="221.2833251953125">Parameters</th><th></th></tr></thead><tbody><tr><td>owner</td><td>The owner Transform</td></tr><tr><td>position</td><td>The Transform or Vector3 where is should play at (Transform can follow position)</td></tr><tr><td>localSoundTag</td><td>The <a href="/docs/soundtag.md">SoundTag</a> which will determine the Local <a href="/docs/soundtag.md">SoundTag</a> of the <a href="/docs/soundevent.md">SoundEvent</a></td></tr><tr><td>soundParameterInternals</td><td>For example <a href="/docs/soundparameter.md">SoundParameterVolumeDecibel</a> is used to modify how the <a href="/docs/soundevent.md">SoundEvent</a> is played</td></tr></tbody></table>

### Stop

{% hint style="info" %}
💡 TIP -  Stopping Loops\
You really only need to use stop for looping or longer oneshot sounds (or the [SoundContainer](/docs/soundcontainer.md) “Stop if Transform is Null” setting).\
Use the polyphony setting in the [SoundEvent](/docs/soundevent.md) to manage the number of instances playing.
{% endhint %}

```csharp
// Stops the SoundEvent at the owner Transform
public void Stop(bool allowFadeOut = true);

// Stops the SoundEvent at the position Transform
public void StopAtPosition(Transform position, bool allowFadeOut = true);
```

<table><thead><tr><th width="129.00006103515625">Parameters</th><th></th></tr></thead><tbody><tr><td>position</td><td>The position Transform</td></tr><tr><td>allowFadeOut</td><td>If the <a href="/docs/soundevent.md">SoundEvent</a> should be allowed to fade out. Otherwise it is going to be stopped immediately</td></tr></tbody></table>

### Pause and Unpause

```csharp
// Pauses/unpauses the SoundEvent with the owner Transform locally
public void Pause(bool forcePause = false);
public void Unpause();

// Pauses/unpauses the SoundEvent everywhere locally
public void PauseEverywhere(bool forcePause = false);
public void UnpauseEverywhere();
```

<table><thead><tr><th width="113.4833984375">Parameters</th><th></th></tr></thead><tbody><tr><td>forcePause</td><td>If the <a href="/docs/soundevent.md">SoundEvent</a> should be paused even if it is set to "Ignore Local Pause"</td></tr></tbody></table>

### Get State

```csharp
// If playing it returns SoundEventState.Playing
// If paused either locally or globally it returns SoundEventState.Paused
// If not playing, but it is delayed it returns SoundEventState.Delayed
// If not playing and it is not delayed it returns SoundEventState.NotPlaying
// If the SoundEvent or Transform is null it returns SoundEventState.NotPlaying
public SoundEventState GetSoundEventState(Transform owner);
```

### Load or Unload Audio Data

```csharp
// Loads the audio data of any AudioClips assigned to the SoundContainers of the SoundEvent
public void LoadAudioData();

// Unloads the audio data of any AudioClips assigned to the SoundContainers of the SoundEvent
public void UnloadAudioData();
```
