# null reference exception with FMOD in unity integration.

**URL:** https://qa.fmod.com/t/null-reference-exception-with-fmod-in-unity-integration/11713
**Category:** Unity
**Created:** [November 5, 2014, 4:09pm UTC](https://qa.fmod.com/t/null-reference-exception-with-fmod-in-unity-integration/11713 "2014-11-05T16:09:54Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![MattLightbound](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@MattLightbound](https://qa.fmod.com/u/MattLightbound)
#### Post date: [November 5, 2014, 4:09pm UTC](https://qa.fmod.com/t/null-reference-exception-with-fmod-in-unity-integration/11713/1 "2014-11-05T16:09:54Z")

</div>

I’ve seen a few people have this problem on the forum that have fixed it with insuring the Main Camera has the FMOD listener component attached to it however I am still receiving these errors with it attached. I have also made sure FMOD, unity and the integration package are all up to date and started the process repeatedly again from scratch. I still receive these error codes:

NullReferenceException: Object reference not set to an instance of an object  
FMOD\_StudioSystem.PlayOneShot (System.String path, Vector3 position, Single volume) (at Assets/Plugins/FMOD/FMOD\_StudioSystem.cs:225)  
FMOD\_StudioSystem.PlayOneShot (System.String path, Vector3 position) (at Assets/Plugins/FMOD/FMOD\_StudioSystem.cs:217)  
PlayerController.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Scripts/PlayerController.cs:56)

Any help would be much appreciated 🙂

---

<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: [November 6, 2014, 12:25am UTC](https://qa.fmod.com/t/null-reference-exception-with-fmod-in-unity-integration/11713/2 "2014-11-06T00:25:45Z")

</div>

This is happening because the event path you’re passing into PlayOneShot() doesn’t correspond to any event.

In the next release we’ll improve the logging and stop the crashing.

---

<div class="post-metadata">

### Author: ![MattLightbound](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@MattLightbound](https://qa.fmod.com/u/MattLightbound)
#### Post date: [November 6, 2014, 9:47am UTC](https://qa.fmod.com/t/null-reference-exception-with-fmod-in-unity-integration/11713/3 "2014-11-06T09:47:44Z")

</div>

> [@](#):
>
> This is happening because the event path you’re passing into PlayOneShot() doesn’t correspond to any event.
> 
> In the next release we’ll improve the logging and stop the crashing.

Is there nothing I can do in the mean time then?

---

<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: [November 6, 2014, 8:25pm UTC](https://qa.fmod.com/t/null-reference-exception-with-fmod-in-unity-integration/11713/4 "2014-11-06T20:25:22Z")

</div>

Yes, don’t call PlayOneShot() with event names that don’t exist. You can check if GetEvent() returns non-null to see if the event path exists.

---

<div class="post-metadata">

### Author: ![MattLightbound](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@MattLightbound](https://qa.fmod.com/u/MattLightbound)
#### Post date: [November 7, 2014, 12:00am UTC](https://qa.fmod.com/t/null-reference-exception-with-fmod-in-unity-integration/11713/5 "2014-11-07T00:00:33Z")

</div>

Thanks very much for the info, i have worked round it now 🙂

---

<div class="post-metadata">

### Author: ![afrech](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/afrech/32/1573_2.png) [@afrech](https://qa.fmod.com/u/afrech)
#### Post date: [November 18, 2014, 9:36pm UTC](https://qa.fmod.com/t/null-reference-exception-with-fmod-in-unity-integration/11713/6 "2014-11-18T21:36:32Z")

</div>

Hi Matt, would you mind mentioning what you did to fix the error? I’m having the exact same one. It sounds like I just have the even name incorrect, but I’ve checked it over and over without finding anything wrong. Cheers

---

<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: [November 18, 2014, 9:42pm UTC](https://qa.fmod.com/t/null-reference-exception-with-fmod-in-unity-integration/11713/7 "2014-11-18T21:42:17Z")

</div>

Hi Andy,

If you grab version 1.05.06 of the integration the issue reported by Matt is fixed. If you’re still having problems then it’s a separate issue and please start a new topic.

---

<div class="post-metadata">

### Author: ![afrech](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/afrech/32/1573_2.png) [@afrech](https://qa.fmod.com/u/afrech)
#### Post date: [November 18, 2014, 10:05pm UTC](https://qa.fmod.com/t/null-reference-exception-with-fmod-in-unity-integration/11713/8 "2014-11-18T22:05:18Z")

</div>

Thanks Nicholas, I will do that!
