"FMOD Studio Event Emitter" component isn't working with Mouse Down/Up?

I have an odd issue, I must be missing something obvious but not sure what. I’m hoping someone spots my oversight.

This is in Unity 2019.4.32f1 LTS with FMOD Studio 2.02.07 and the corresponding Unity integration.

  • In Unity, I create a UI > Button in a scene.
  • I add the “FMOD Studio Event Emitter” component to it.
  • I assign an event.
  • I set the Play Event = Mouse Down or Up.
  • I play the scene and click the button.
  • OBSERVED: I don’t hear any sound.

Now, if I stop the scene and change Play Event = Object Start and set the sound to an obnoxious loop, I definitely hear it when the scene plays. There’s a listener in there. Other scripted sounds using FMOD play.

I recall this working for me once, am I missing something else I need to do?

Hi,

The Mouse Play/Stop Event triggers all rely on MonoBehaviour’s Mouse-related methods, in this case MonoBehaviour.OnMouseDown(). These methods, and by extension the StudioEventEmitter trigger conditions, require a Collider to be on the same GameObject in order to function. I believe OnMouseDown() used to be compatible with GUIElement before Unity 2019.3, but Unity has since moved to EventSystems interfaces for handling UI callbacks - the relevant one in this case being EventSystems.IPointerDownHandler.

The StudioEventEmitter doesn’t currently implement the interface, so you won’t be able to handle this case using solely the Play/Stop Event trigger functionality. Instead, you’ll have to implement the interface in your own script, and handle StudioEventEmitter functionality from there. That said, I’ve added UI trigger Play/Stop Event triggers to our internal feature/improvement tracker.

1 Like

@Leah_FMOD Thank you for the clarification. So does this mean that my expected behavior does NOT work on newer Unity versions, even 2021 LTS?

And that if I’m understanding you correctly, StudioEventEmitter Mouse Down/Up trigger conditions — and which others? — need to be upgraded by your team?

I have a script in progress that uses a method related to what you mentioned, to play FMOD events when I do Mouse Up/Down clicks. Although I’ve got it working, seems like the documentation should call out this important distinction? https://www.fmod.com/docs/2.02/unity/game-components.html#trigger-conditions

I’m actually kind of surprised I didn’t find more matches for it, given that this seems to be the first thing to go to with Unity-FMOD integration, before scripting.

As far as I’m aware, your expected behavior will not work on any newer Unity versions, including 2021 LTS.

It should just be the Mouse Down/Up and Enter/Exit trigger conditions; all other trigger conditions rely on Unity functionality that is still present.

Thanks for pointing that out, I’ve flagged some documentation changes internally.

1 Like

Thanks again @Leah_FMOD I hope your answers will help someone else out if they come a-lookin’!

1 Like