Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

0 votes
We're using Unity 5 and TBE 3Dception and would like to know if it's possible to attach a 3D sound to a particle effect.

 

Cheers in advance...
in General Discussion by Matt sneakSounds (460 points)

1 Answer

0 votes
 
Best answer
A particle effect is a component, so it needs to be attached to a GameObject. Simply attach an AkAmbient component to the same GameObject as the particle effect.
by Benoit S. (Audiokinetic) (16.0k points)
selected by Benoit S. (Audiokinetic)
Hi Benoit and thanks for the quick response. My bad though, I should have been more specific... I meant is it possible to attach sounds to individual particles? The way we're using the particle system means we have very wide separation on each particle and I'd like to associate a sound with each of the individuals.
Unfortunately, individual particles are not GameObjects in Unity, so the simple answer is no. A quick Google search shows that this is not possible even with the built-in Unity audio.

However, with some scripting, you could achieve something. You have access to each particle's position and rotation (see here: http://docs.unity3d.com/ScriptReference/ParticleSystem.Particle.html ). You could (at init time) create a certain number (say, maxParticles of your Particle System if you want every single particle to play a sound) of empty GameObjects with an AkGameObj component attached to them. When you wish to post an event on a particular particle, you could get the particle's position, move an empty GameObject to that position, and then call AkSoundEngine.PostEvent using that GameObject.

If your sound is short, you don't need to do anything else. The sound will play at the particle's position, and then it's over. But if you want to play longer 3D sounds, you will need to keep updating your empty GameObjects' positions.

Be careful with this, though. If you have a big number of particles in your particle system, this will use a lot of memory and CPU!
Thanks very much for the help, I'll pass the info on to my coder and see wee what we can do.

All the best,
Matt
...