I went ahead and created 2 GIT pull requests a while back addressing this issue alongside some other performance and usability issues we had encountered. (I also mailed these to you just in case).
For people interested in this or who are running into the same issues for the time being.
There are 2 pull requests:
o Fixed issues with the AttachInstanceToGameObject methods.
This mainly fixes issues when being called via the PlayOneShotAttached
AttachInstanceToGameObject now directly sets the 3dAttribute while attaching
to ensure an initial correct and valid 3d positioning is applied.
Before a 3d position would only by applied to the instance in the next
update after the attach occured.
This can cause unexpected and unwanted results in case the target transform
was destroyed between the attach and the update loop.
Example: A crate that plays a PlayOneShotAttached when it hits a surface but
that also takes damage at the same time that can result in a destroy. The
sound would play at the incorrect location as there was never an initial
position set that matched the desired start position. This small change will
Also added a small change to the way the DebugOverlay is being activated and
rendered removing a Garbage Collection overhead in both editor and
standalone builds, even if the overlay was not enabled.
Before, even just having an OnGUI method in your component would trigger the
Unity legacy UI system to be running causing a performance overhead, even if
nothing is being drawn as well as an occasional garbage allocation.
This is now only the case if the debug overlay is enabled, removing all the
overhead that was being created when the debug overlay is disabled.
o Added some safety code to ensure emitters are nicely cleaned up on
destroy. Not sure if this was really needed but we did notice some
inconsistency with the event instance clean-ups. This small addition would
ensure a correct cleanup of the sound event instance when dealing with
Added the ability to SetParameter by index instead of string. (A usability
(Apologies for this commit being somewhat strange with the addition of the
https://github.com/fmod/UnityIntegration/pull/14 changes that where then
reverted out of this branch. This was mainly to allow for these changes to
be available as a standalone pull request. I haven’t used github before so I
was unsure on how to resolve this in a more clean way.)
I hope these will be of help to some people