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?
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.