<!? THIS PROBLEM HAS BEEN FIXED! <!>
Heres the scenario: I’m using a few FMOD events in the game (3-4 continuously playing 3D events), these events have their parameters changed every frame based on player input, they are also attached to a rigidbody every frame using the RuntimeManager.AttachToGameObject() function.
As is visible on the profiler, RuntimeManager.Update() is taking up pretty much all of the CPU usage. It starts out at normal levels, but gradually gets worse over time until the game becomes unplayable. A memory leak maybe? Probably not, as the profiler shows memory usage doesn’t go up at all. It really is the FMOD update loop that is slowing down my game, which is annoying. Ill be expanding this post further after I take a look at the FMOD RuntimeManager code. All help is welcome. I really hope I’m not the only one experiencing this.
I get warnings in the editor that the AsyncCommandBuffer is expanding. Any ideas on what could be causing this?
Based on another post on this forum, I expanded the FMOD code to accept velocity of non-rigidbody objects like the camera object in our game. I did this because the velocity of the listener object does not get taken into account for the doppler effect by default. So if anything, it’s my code that is the problem. It’s a small change though so I don’t see why it’s causing so much trouble.
This is the code that the warning refers me to, line 464:
Problem solved, one of the overloads of the AttachInstanceToGameObject method (That I wrote) failed to check if the AttachedInstance was already included in the list. As a result, it was continuously adding the same instances to the list every frame, causing it to grow rapidly.