|
Post by rxmarcus on Jul 30, 2014 0:56:21 GMT
So I've read through the quick start guide, and I am confused at how I can stop the playback of a single audio instance. I see methods for stopping an entire group, but how can I stop just a single instance of a sound? For example in my game player shoot rockets which play a sound, and when the rocket hits a wall I need to stop the rocket sound just for that 1 rocket.
Thanks in advance Marc
|
|
|
Post by DarkTonic Dev on Jul 30, 2014 1:06:48 GMT
Normally people are using "Stop All Sounds Of Transform", which stops all sounds made by a single Transform (or GameObject). To use that, the sound must follow the Game Object or be triggered at its location. You can set up EventSounds script using the Disable event (gets triggered when the object gets despawned or destroyed) and hook it up to "Stop All Sounds Of Transform" which is under the Group Control action type.
Also in the very next version, I've added modes to automatically stop or fade the sound once the Transform that made it despawns, settable on the Sound Group itself. You can use either of these.
|
|
|
Post by rxmarcus on Jul 30, 2014 1:48:04 GMT
So what would you suggest I do for when I need to play a sound but I don't really spawn any objects to attach it to? For example a machine gun that shoots bullets, I just would like to play a sound each time it fires, but no actual game object is created on each fire, only a raycast is shot to see if anything was hit...
|
|
|
Post by DarkTonic Dev on Jul 30, 2014 2:56:44 GMT
You still want to use the location of some object (your player or the gun), and then you'll be able to use the Stop All Sounds Of Transform command because you're telling it to play the sound at that Transform's location. It doesn't mean you're spawning things, they can be objects already in the Scene. Sorry if I wasn't clear.
|
|