# Preview FMOD events in Unity Editor

**URL:** <https://qa.fmod.com/t/preview-fmod-events-in-unity-editor/16486>\
**Category:** Unity\
**Created:** [November 27, 2020, 6:14pm UTC](https://qa.fmod.com/t/preview-fmod-events-in-unity-editor/16486 "2020-11-27T18:14:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![facaelectrica](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/facaelectrica/32/105_2.png) [@facaelectrica](https://qa.fmod.com/u/facaelectrica)\
**Post date:** [November 27, 2020, 6:14pm UTC](https://qa.fmod.com/t/preview-fmod-events-in-unity-editor/16486/1 "2020-11-27T18:14:09Z")

</div>

In our project, we have over 1500 unique animations, and we are triggering FMOD audio events using Unity Animation Events (mostly OneShot).  
We trigger events like Footsteps, sfx effects as well as dialogue lines that are timed with the animation.  
And we also feed parameters to add variety or multi-instruments for variation, etc.

We’ve created a tool that allows us to preview animations (saving us a LOT of time so we don’t have to play the game to see if everything is working), and we would like to also preview the sfx that are getting triggered by these animation events.

What we are missing is to actually be able to call and play FMOD events in the editor. Is this possible? Any guidance would be much appreciated!

---

<div class="post-metadata">

**Author:** ![facaelectrica](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/facaelectrica/32/105_2.png) [@facaelectrica](https://qa.fmod.com/u/facaelectrica)\
**Post date:** [November 30, 2020, 4:25pm UTC](https://qa.fmod.com/t/preview-fmod-events-in-unity-editor/16486/2 "2020-11-30T16:25:55Z")

</div>

So I got this to work by digging into the EditorUtils.cs and learning from the code there.

The only issue I’m running into is to preview Programmer sounds. How can I access an AudioTable and assign it to an EditorEventRef through the Editor ? Kind of like we would do in-game:

```
			eventInstance.setUserData(GCHandle.ToIntPtr(stringHandle));
			eventInstance.setCallback(dialogueCallback);

```

I can’t seem to find an example to go from in the FMOD Editor menu options…

---

<div class="post-metadata">

**Author:** ![facaelectrica](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/facaelectrica/32/105_2.png) [@facaelectrica](https://qa.fmod.com/u/facaelectrica)\
**Post date:** [December 3, 2020, 10:26pm UTC](https://qa.fmod.com/t/preview-fmod-events-in-unity-editor/16486/3 "2020-12-03T22:26:56Z")

</div>

For posterity, I looked at the _EventBrowser.cs_ as well as _EditorUtils.cs_ (making some of the methods public) and now I’m able to preview audio events in the editor!

---

<div class="post-metadata">

**Author:** ![lorisspanu](https://avatars.discourse-cdn.com/v4/letter/l/46a35a/32.png) [@lorisspanu](https://qa.fmod.com/u/lorisspanu)\
**Post date:** [December 22, 2023, 9:56am UTC](https://qa.fmod.com/t/preview-fmod-events-in-unity-editor/16486/4 "2023-12-22T09:56:46Z")

</div>

Hi, I’m working on Unity with lots of animations and animation events triggering FMOD audio events. Like you, I would like to preview the sounds without play the game, directly in the Animation tool of Unity.  
I was wondering if you can explain how you made it works.  
Thanks so much!

---

<div class="post-metadata">

**Author:** ![AldeRoberge](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alderoberge/32/6074_2.png) [@AldeRoberge](https://qa.fmod.com/u/AldeRoberge)\
**Post date:** [June 3, 2024, 4:03pm UTC](https://qa.fmod.com/t/preview-fmod-events-in-unity-editor/16486/5 "2024-06-03T16:03:21Z")

</div>

For future reference, consider this code :

```csharp
var eventReference = GetEventGUID(); // EventReference.Find(path).Guid;
                if (!eventReference.HasValue) return;

                EditorUtils.LoadPreviewBanks();
                EditorUtils.System.getEventByID(eventReference.Value, out var eventDescription);
                eventDescription.createInstance(out _eventInstance);

                _eventInstance.start();

```

---

<div class="post-metadata">

**Author:** ![lorisspanu](https://avatars.discourse-cdn.com/v4/letter/l/46a35a/32.png) [@lorisspanu](https://qa.fmod.com/u/lorisspanu)\
**Post date:** [June 3, 2024, 4:25pm UTC](https://qa.fmod.com/t/preview-fmod-events-in-unity-editor/16486/6 "2024-06-03T16:25:32Z")

</div>

Thanks @AldeRoberge ! Can I ask you where to put these lines of code? On the animation event script?  
Thanks

---

<div class="post-metadata">

**Author:** ![AldeRoberge](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alderoberge/32/6074_2.png) [@AldeRoberge](https://qa.fmod.com/u/AldeRoberge)\
**Post date:** [June 3, 2024, 4:46pm UTC](https://qa.fmod.com/t/preview-fmod-events-in-unity-editor/16486/7 "2024-06-03T16:46:55Z")

</div>

Hello, unfortunately I’m not sure if this would be of much help for your use case.  
Consider using the Timeline, which supports FMOD event playables.  
[https://www.fmod.com/docs/2.03/unity/timeline.html](https://www.fmod.com/docs/2.03/unity/timeline.html)
