First of all, I’m using Unity 6000.2.13f1 and FMOD 2.02.31 and integration 2.02.32.
A quick question: what would be the best strategy to “persist” a oneshot sound across scenes?
In my game I can open doors and go up/down stairs to go to other scenes. Both these doors and stairs objects have a FMODStudioEventEmitter component attached to them, so when the player interacts with it, I play the desired sound event. However, I’d like to keep playing the sound across scenes, so when the new scene loads, the event is playing until it finishes.
Both events are Action 2D, however:
The door sound event have an open and a close sound that play in a consecutive way.
The stair sound event is a multi instrument, where I’m randomizing n sounds and playing it m times.
What I noticed is that the stair event sometimes stutter in Unity, like it play 3 times and then the last one with a bit of a delay (and in FMOD, when I hit the play button, sometimes it plays faster and sometimes a little bit slower ).
Also, I’m always getting the log warning [FMOD] SoundSourceInstrumentInstance::startChannelIfReady : Loading delay exceeded, sound may play at incorrect time when dealing with both events.
Any ideas what I might be doing wrong? I read somewhere that it might be related to the fact that the sounds aren’t fully loaded and I’m trying to play it. I followed some instructions (such as marking ‘Preload Sample Data’ or ‘Load Banks’ set to ‘All’ in FMOD Settings inside Unity) but I’m still facing the same problem.
For one shots that need to continue playing across scene loads, the safest approach is to create the EventInstance manually (instead of relying on a StudioEventEmitter on a scene object) and let it live in a DontDestroyOnLoad manager. Once started, the instance will keep playing until it finishes, even if Unity loads a new scene.
This usually means the sample data wasn’t fully loaded when the instruments triggered. Could you please double check that the assets aren’t set to Stream, and that Preload Sample Data is enabled on the events?
I tried doing that, but I’m still facing the same problem. I used FMODStudioEventEmitter just to hold the EventReference, but I created an event instance inside a test script, set it to DontDestroyOnLoad and started > released > cleared the handle. No sucess, though.
My settings are exactly like that!
Is there anything else I can try? I’m not really sure, but the footsteps sounds I’m trying to play are like 0.2s each. Maybe there is a connection?