# How to trigger FMod with Pixel Crushers in Unity

**URL:** <https://qa.fmod.com/t/how-to-trigger-fmod-with-pixel-crushers-in-unity/20222>\
**Category:** Unity\
**Tags:** unity\
**Created:** [May 16, 2023, 2:59am UTC](https://qa.fmod.com/t/how-to-trigger-fmod-with-pixel-crushers-in-unity/20222 "2023-05-16T02:59:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AChris10](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@AChris10](https://qa.fmod.com/u/AChris10)\
**Post date:** [May 16, 2023, 2:59am UTC](https://qa.fmod.com/t/how-to-trigger-fmod-with-pixel-crushers-in-unity/20222/1 "2023-05-16T02:59:14Z")

</div>

We are using FMod as our main Audio engine in a Unity game build. We use Pixel Crushers for the dialogue system. Does anyone have experience triggering FMod Dialog audio cuts to match text from Pixel Crushers dialog system?

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [May 17, 2023, 5:58am UTC](https://qa.fmod.com/t/how-to-trigger-fmod-with-pixel-crushers-in-unity/20222/2 "2023-05-17T05:58:35Z")

</div>

Hi,

Could I grab some info,  
What version of FMOD are you using?  
How are you playing the dialog using FMOD? e.g. Programmer instrument ([FMOD API | Studio API Guide - Dialogue and Localization](https://fmod.com/docs/2.02/api/studio-guide.html#dialogue-and-localization))  
Could I get a code snippet of how dialogue cuts are handled?

---

<div class="post-metadata">

**Author:** ![AChris10](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@AChris10](https://qa.fmod.com/u/AChris10)\
**Post date:** [May 17, 2023, 10:08am UTC](https://qa.fmod.com/t/how-to-trigger-fmod-with-pixel-crushers-in-unity/20222/3 "2023-05-17T10:08:05Z")

</div>

Hi Connor, I believe the programer is using Pixel Crushers for the Dialogue system in Unity. We just finished recording audio from voice actors to match the dialogue. I assume I will need to make parameters that are triggered by certain pixel crushers commands- maybe the dialog lines themselves can be tagged to match FMod parameters we make. We are still planning how to get everything to work together. I check on the FMod version I have. I typically update when I get a notice.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [May 18, 2023, 12:43am UTC](https://qa.fmod.com/t/how-to-trigger-fmod-with-pixel-crushers-in-unity/20222/4 "2023-05-18T00:43:58Z")

</div>

Hi,

We have a Unity scripting example outlining how to use programmer instruments: [Unity Integration | Scripting Examples - Programmer Sounds](https://fmod.com/docs/2.02/unity/examples-programmer-sounds.html), which may be useful when planning your implementation.

In the example, input is used to trigger the dialogue audio

```auto
void Update()
{
	if (Input.GetKeyDown(KeyCode.Alpha1))
	{
		PlayDialogue("640148main_APU Shutdown");
	}
	if (Input.GetKeyDown(KeyCode.Alpha2))
	{
		PlayDialogue("640165main_Lookin At It");
	}
	if (Input.GetKeyDown(KeyCode.Alpha3))
	{
		PlayDialogue("640169main_Press to ATO");
	}
}

```

What I would suggest is using a similar system to call the `PlayDialgue()` function but triggered by the `Pixel Crusher` commands. When dialogue is skipped you can use the `EventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE)` to cut the audio.

Let me know if that helps!

---

<div class="post-metadata">

**Author:** ![AChris10](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@AChris10](https://qa.fmod.com/u/AChris10)\
**Post date:** [May 18, 2023, 9:39am UTC](https://qa.fmod.com/t/how-to-trigger-fmod-with-pixel-crushers-in-unity/20222/5 "2023-05-18T09:39:40Z")

</div>

Connor,

Thanks for the help! Some of it makes sense to me, but I will get to to our programer, who will completely understand the script lol. I really appreciate the help!

Chris  
7SP

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [May 18, 2023, 11:05pm UTC](https://qa.fmod.com/t/how-to-trigger-fmod-with-pixel-crushers-in-unity/20222/6 "2023-05-18T23:05:07Z")

</div>

All good, if you have any more questions please do not hesitate to ask!
