|
Post by paulbennett on Sept 22, 2014 12:44:31 GMT
Hi guys, I've started using this plugin and am liking it so far, but would like some advice on how to structure Master Audio for a game that has many sounds on many game objects.
The setup is I have a set of characters and they each have something like 5 individual sounds for actions like attack, take damage, death etc. There may be multiple instances of each of these characters in the game at any time, or they may not exist in the game at all depending on what spawns. Each character has its own prefab.
I would like the designers to be able to specify the sounds for each character on the prefabs themselves, as that'll make it easier for theme to update sounds in the future.
I think I'll probably need to use custom events which are fired as a character event happens, which is fine, however if I create events in the prefabs and multiple instances of a prefab spawn I'm not sure how to reference a specific prefab to play the sound - I don't want the sound played for all instances of the prefab that contains the custom event.
Has anyone used a setup similar to this in the past? Or would anyone be able to offer any advice on how best to achieve this?
Thanks!
|
|
|
Post by DarkTonic Dev on Sept 22, 2014 13:45:48 GMT
You basically are using "audio skins".
It sounds like you will want to use a Dynamic Sound Group Creator prefab on each prefab. Then the designers can add the sounds themselves to the prefab and when they are spawned (or if they start in a Scene) the Sound Groups will get added to Master Audio automatically.
If more than a single "skin" of a sound can be played simultaneously, you will probably want to make sure that every single Sound Group on every prefab is named uniquely though (maybe prefixed with the character name), so that no matter which combination of characters are in your Scene, there will be no duplicate names. So maybe Sound Groups like "Librarian_Death", etc.
You should be able to use the Event Sounds component for most things (collider / visible / and other events) and type in the name of the Sound Group that's in your DSGC (it won't appear in the dropdown if it's not in the Master Audio prefab). Then you can use custom events if you need to (by the way you can create appropriately named - prefixed if you need - Custom Events in the DSGC as well). Custom events can't be limited like you want (except by distance from "event caller" game object), but if you configure the Sound Groups to only have a single voice per sound (the default - the "weight" field controls this), no more will be played even if there are multiple custom event receivers.
Let us know if there's anything that's missing or would be useful, but I think you're good to go!
|
|
|
Post by paulbennett on Sept 22, 2014 14:49:37 GMT
Thanks! That's the approach I've taken and it works well. The only downside I can see is that when another instance of the prefab spawns, the "Can't add a new Sound Group" error is logged because the sound group already exists at this point.
|
|
|
Post by DarkTonic Dev on Sept 22, 2014 15:05:45 GMT
Right, that's not going to hurt anything but it's annoying. If you like I can change that to a warning for that particular message (actually for all things created by the Dynamic SGC).
Better yet, how about if there was a checkbox to "don't create if already exists" for everything set up in the Dynamic SGC? It would default to off, but turning it on would mean no errors or warnings would get logged for your case.
Does that sound good? I could put that in the next version because it would be really easy to do I think.
|
|
|
Post by paulbennett on Sept 22, 2014 15:58:12 GMT
That sounds awesome, thanks for the great support 
|
|
|
Post by DarkTonic Dev on Sept 23, 2014 1:51:55 GMT
Excellent, I'll add that on the next go-around.
|
|