Playback State returns PLAYING but the sound cannot be heard

(Mariya Marinova) #1

Hi, people! I have been playing around with FMOD and Unity for some time now, and I am a bit stuck. I have a sound that I want to be played whenever the player moves. I achieved this with Unity’s AudioSource, but I want to change it to using FMOD components now.

I had this code before:

void PlayStep(AudioSource step) {
    if (step.time > 2.4 || !step.isPlaying)

After an intense googling session, it now looks like this:

void PlayStep(FMOD.Studio.EventInstance step, FMOD.Studio.PLAYBACK_STATE playState) {
    if (playState != FMOD.Studio.PLAYBACK_STATE.PLAYING) {

The print shows ‘PLAYING’ all the time, yet nothing can be heard.

The sound is in a Control.cs script, which is attached to the Player. I also have a background track as another component (which might be the reason I get ‘PLAYING’). (Edit: I tried removing the track, but I still get ‘PLAYING’). However, I am still not sure how to attach an FMOD audio, be it an instance or an event emitter as a component, which could be what is causing the problem too…

Any clues and help is much appreciated. Thanks a lot!

EDIT: Turns out the code was functioning, but the player was away from where the Event was played from - (0,0,0). I have posted a slightly more detailed explanation (and, of course, all the issues that followed) here: . I thought it’s wort keeping the thread in case someone runs into a similar problem :slight_smile:

(Andrew Scott) #2

Problem solved by OP above ^^^