Reuse instance in EventEmitter

Hello,

We have built a system in our current game that relies on using the EventEmitter component for most of our audio as a lot of the code for cleaning up and various checks is already there, however it looks like the EventInstance in the emitter is not reused and new instance are created each time, whilst this is the recomended behaviour it might be useful for people who use the emitter for things like footsteps to have an option to reuse the instance instead of using unneccesary CPU to create and release instances.

Am I missing something and this behaviour is already available?

Thanks for your time!

Hi,

Thank you for the suggestion. I can definitely see how controlling the behavior via the emitter could be useful.

The issue may be that the event is being marked as isOneShot: FMOD Engine | Studio API Reference - Project.Model.Event.

An options may be adding behavior to the event in Studio so that it doesn’t have a defined end time, this can be done by adding a small loop region on on the logic track:
image.

Would it be possible to get a screen shot of your event in Studio? Could you also elaborate on how you are triggering the footsteps in code?

Hey Connor, thanks for the speedy response!

Thanks for the tip, that does work! but seems a tad messy still, I’m guessing it would still consume a little cpu especially since we’re making a multiplayer game with multiple player’s, so we could essentially have a whole bunch of instances playing dead air haha

Basically we’re trying to use emitters as much as possible as they’re quite convinient for grabbing references in the editor and already have code written for it etc Obviously we could write our own event player but seems like we’d just be copying a bunch of code from the emitter anyway.

Sure thing here’s the event (all sounds/instruments are placeholder while I wait for the art)

We’re playing the emitters in our foot effects script from a play function which is called from an animation event

There is the option of just commenting out the release function inside Play() but we obviously don’t want to really touch the included code.

Thanks Connor!

Thank you for the info and the screenshots.

An alternative option would be enabling the persistent (FMOD Studio | Event Macro Controls Reference - Persistent) on the event:

Hope this helps!