You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Splashes are created by FXMonger by cloning a prefab from FXMonger.splashes. It manages a queue of splashes to create, and tries to merge ones that are close enough in time and distance. However the splash objects themselves are not pooled. The prefab contains the Splashdown component which self-destructs on a timer, and it's the destruction of the audio source in the cloned object that turns out to be really expensive.
The FXMonger also creates an FXObject and assigns the AudioClip to play in there, but I can't actually see how this gets connected to the AudioSource in the splash object. It follows a similar pattern as explosions, ROC explosions, and debris explosions, but those all have an immediate call to AudioSource.PlayOneShot. It seems like instead, the AudioSource in the prefab already has the clip assigned and plays it on awake. I'm not sure if this has any differences when compared to how PlayOneShot works.
In any case it seems like pooling these effects and re-using them would significantly help here (and maybe for the explosion cases too - need to profile that!). Is there some way that we can leverage AudioMultiPooledFX ?
Update: this seems to only be this terrible when RSE is installed. Without RSE, instantiating and destroying the splash effects is still pretty expensive but it's not game-breakingly so.
When driving a boat across the water, this gets real expensive. Would pooling help?
The text was updated successfully, but these errors were encountered: