# Sound in Fmod, but no sound in Unity. Tried everything!

**URL:** https://qa.fmod.com/t/sound-in-fmod-but-no-sound-in-unity-tried-everything/11707
**Category:** Unity
**Created:** [October 30, 2014, 7:27pm UTC](https://qa.fmod.com/t/sound-in-fmod-but-no-sound-in-unity-tried-everything/11707 "2014-10-30T19:27:33Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Nexigen](https://avatars.discourse-cdn.com/v4/letter/n/48db29/32.png) [@Nexigen](https://qa.fmod.com/u/Nexigen)
#### Post date: [October 30, 2014, 7:27pm UTC](https://qa.fmod.com/t/sound-in-fmod-but-no-sound-in-unity-tried-everything/11707/1 "2014-10-30T19:27:33Z")

</div>

Here is my problem:

I can successfully integrate sound Events from fmod to unity. When I do that, I hear sound in both fmod and unity. However, when I (in C#) try to change the volume with a parameter set to increase volume when getting near an object and to lower the volume when the object goes farther away, I don’t hear any sound at all. I don’t have a 3d panner in my master, the script has been compiled and deemed bug-free and when I trace my parameter value it actually goes up and down when nearing or stepping away from an object. Still… there is no sound. Again, I do have sound when I only integrate events in unity and let them play, but this specific C# distance thingie I’m trying to implement is not giving me any sound. I’m not even sure whether it is the script or something else.

The object in game which has my studio event emitter attached to it is called BattleCylinder.  
You can view the script here, I made a pastebin :

[http://pastebin.com/9aGzycZ4](http://pastebin.com/9aGzycZ4)  
(Everything commented out is not -i think- relevant)

---

<div class="post-metadata">

### Author: ![geoff](https://avatars.discourse-cdn.com/v4/letter/g/a3d4f5/32.png) [@geoff](https://qa.fmod.com/u/geoff)
#### Post date: [October 30, 2014, 10:35pm UTC](https://qa.fmod.com/t/sound-in-fmod-but-no-sound-in-unity-tried-everything/11707/2 "2014-10-30T22:35:27Z")

</div>

FMOD Studio has several automatic parameters and Distance is one of them. The automatic Distance parameter is updated using the emitter’s GameObject transform and the listener’s GameObject transform for you, and it will override any attempt to set it manually.

You can do one of two things:

1. Use the automatic Distance parameter and just set GameObject positions in Unity.

2. Create a normal parameter not called Distance, and then set it manually as you have been doing.

---

<div class="post-metadata">

### Author: ![Nexigen](https://avatars.discourse-cdn.com/v4/letter/n/48db29/32.png) [@Nexigen](https://qa.fmod.com/u/Nexigen)
#### Post date: [October 31, 2014, 1:02am UTC](https://qa.fmod.com/t/sound-in-fmod-but-no-sound-in-unity-tried-everything/11707/3 "2014-10-31T01:02:06Z")

</div>

> [@](#):
>
> FMOD Studio has several automatic parameters and Distance is one of them. The automatic Distance parameter is updated using the emitter’s GameObject transform and the listener’s GameObject transform for you, and it will override any attempt to set it manually.
> 
> You can do one of two things:
> 
> 1. Use the automatic Distance parameter and just set GameObject positions in Unity.
> 
> 2. Create a normal parameter not called Distance, and then set it manually as you have been doing.

I tried changing the name from Distance to musicDistance. This resulted in the same problem, no sound. So I tried using the automatic distance parameter. This resulted in the value actually being changed from 0 to 1 to something entirely else. It gave me an error too.

NullReferenceException: Object reference not set to an instance of an object  
DistanceScript.Update () (at Assets/Plugins/FMOD/DistanceScript.cs:46)

So unfortunately both of these options are sadly enough not working ☹  
Might there be something else I missed?

---

<div class="post-metadata">

### Author: ![nick1](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@nick1](https://qa.fmod.com/u/nick1)
#### Post date: [October 30, 2014, 10:44pm UTC](https://qa.fmod.com/t/sound-in-fmod-but-no-sound-in-unity-tried-everything/11707/4 "2014-10-30T22:44:58Z")

</div>

Your script needs to call the Start() method on the EventInstance object.

---

<div class="post-metadata">

### Author: ![Nexigen](https://avatars.discourse-cdn.com/v4/letter/n/48db29/32.png) [@Nexigen](https://qa.fmod.com/u/Nexigen)
#### Post date: [October 31, 2014, 1:11am UTC](https://qa.fmod.com/t/sound-in-fmod-but-no-sound-in-unity-tried-everything/11707/5 "2014-10-31T01:11:44Z")

</div>

> [@](#):
>
> Your script needs to call the Start() method on the EventInstance object.

What do you mean exactly? I do have the Start() function typed as : void Start () {  
}

In there I set the parameters and double check if the objects are linked.

---

<div class="post-metadata">

### Author: ![nick1](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@nick1](https://qa.fmod.com/u/nick1)
#### Post date: [October 31, 2014, 3:07am UTC](https://qa.fmod.com/t/sound-in-fmod-but-no-sound-in-unity-tried-everything/11707/6 "2014-10-31T03:07:42Z")

</div>

You need to add the line ForestSound.start(); at line 31.

---

<div class="post-metadata">

### Author: ![Nexigen](https://avatars.discourse-cdn.com/v4/letter/n/48db29/32.png) [@Nexigen](https://qa.fmod.com/u/Nexigen)
#### Post date: [October 31, 2014, 4:47pm UTC](https://qa.fmod.com/t/sound-in-fmod-but-no-sound-in-unity-tried-everything/11707/7 "2014-10-31T16:47:32Z")

</div>

That worked! Thank you! I’m so stupid. Seriously you have no idea how much I love you now. Thank you again!
