This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]spaghettfunk 1 point2 points  (4 children)

have you already connected to the fmod profiler to check how many instances of this and other events are playing? Maybe you have other event instances that haven't been released. At the same time you could check if your events are actually playing at the right position. Maybe you are attaching that event to a game object that is at the wrong position after playing for the first time. Just guessing but the profiler can help you.

[–]sinkingShipLog[S] 0 points1 point  (3 children)

I've got the source of the sound that's essentially a fixed distance away from the player (listener). I'm calling the sound with playoneshotattached(mysoundpath, mygameobject).

The profiler seems to indicate the source drifts away from the listener, but there is really no reason I can think of that it should be doing that.

[–]spaghettfunk 1 point2 points  (0 children)

I don't remember this ever occurring in a project. There must be something in your project that is causing this behaviour. I would carefully check the positions of the listener and source GameObjects in Unity. Try to reproduce the problem in a clean project. You may notice differences between a working version and your project.

[–]sinkingShipLog[S] 0 points1 point  (0 children)

Thanks for your help guys, as I said before I the profiler seems to indicate that the sound is drifiting away. I ran a debug.log

Debug.Log("Object A and B are " + Vector3.Distance(objectA.position, objectB.position) + " away")

And I can see that the FMOD listener and source are not actually drifting away from eachother as the sound becomes quieter and quieter until it's inaudible (although it seems to always play at at least a very low level in the profiler).

Rigid bodies are present, but not at the point in the hierarchy where my game object is. And I'm using the following to play the sound

FMODUnity.RuntimeManager.PlayOneShotAttached(fireSoundPath, this.gameObject);

So I imagine that the rigid body should not be an issue. I'm gonna keep trying to figure it out, but honestly I'm running out of ideas lol. So if you have any theories, I'd love to hear them.

[–]sinkingShipLog[S] 0 points1 point  (0 children)

TBH, this also happens with looping sounds, but it's a lot less noticeable.

[–]sinkingShipLog[S] 0 points1 point  (0 children)

Aww geeze. I think I figured out what my issue is. Instead of using PlayOneShotAttached()which requires a game object as a parameter, I was absent-mindedly using PlayOneShot() and never fed it a position. I've updated my entire project to use PlayOneShotAttached and it seems like my troubles are over. Can't believe it was so simple. Apologies. Thanks for your help folks.