# Safely check whether an event exists to avoid crashes in live build

**URL:** https://qa.fmod.com/t/safely-check-whether-an-event-exists-to-avoid-crashes-in-live-build/15091
**Category:** Unity
**Created:** [October 2, 2019, 12:37am UTC](https://qa.fmod.com/t/safely-check-whether-an-event-exists-to-avoid-crashes-in-live-build/15091 "2019-10-02T00:37:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![patsmg](https://avatars.discourse-cdn.com/v4/letter/p/ed8c4c/32.png) [@patsmg](https://qa.fmod.com/u/patsmg)
#### Post date: [October 2, 2019, 12:37am UTC](https://qa.fmod.com/t/safely-check-whether-an-event-exists-to-avoid-crashes-in-live-build/15091/1 "2019-10-02T00:37:18Z")

</div>

I’ve been searching for a solution on this but have been unable to find any way to do it. Hoping I’ve just missed something obvious.

We have a lot of sounds in the game, and some categories of SFX are set up and assigned via our external sheets. We have a pretty safe database generator so no manual strings are being entered anywhere for FMOD events, but things can still slip through the cracks from time to time (it’s happened a few times already, and we’re still in alpha).

My expectation was that the API would let me do something like  
`if(!CheckEventExists("some event")) return;`  
So that as an absolute worst case, a mistake in event path/bank contents would result in silence, not an app crash when CreateInstance() is called on a bad string.

Can’t seem to find anything like that, so I’m hoping others that may be in a similar situation (or have been) might be able to shed light on best practices. Would just like to reduce FMOD’s/game-sound’s chances of crashing (via human error on content) the app to 0%.

---

<div class="post-metadata">

### Author: ![patsmg](https://avatars.discourse-cdn.com/v4/letter/p/ed8c4c/32.png) [@patsmg](https://qa.fmod.com/u/patsmg)
#### Post date: [October 2, 2019, 1:29am UTC](https://qa.fmod.com/t/safely-check-whether-an-event-exists-to-avoid-crashes-in-live-build/15091/2 "2019-10-02T01:29:37Z")

</div>

ok… typically, some continue digging after posting this turned up what I needed.

In case it helps anyone else:  
`RuntimeManager.StudioSystem.getEvent(id, out desc);`

then check .isValid() on out desc object.

If, like in our project, you’re building event paths or managing them externally in your pipeline (e.g. vast spreadsheets of player-equipment), you can make sure your CreateInstance() calls won’t throw an exception from content mistakes.

---

<div class="post-metadata">

### Author: ![alexzzen](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alexzzen/32/6825_2.png) [@alexzzen](https://qa.fmod.com/u/alexzzen)
#### Post date: [October 2, 2019, 2:18am UTC](https://qa.fmod.com/t/safely-check-whether-an-event-exists-to-avoid-crashes-in-live-build/15091/3 "2019-10-02T02:18:27Z")

</div>

You could also check if getEvent returns `FMOD.RESULT.OK`. If the Event doesn’t exists for some reason it should return `ERR_EVENT_NOTFOUND`.
