gabec
New Member
Posts: 16
Posts: 16
|
Post by gabec on Dec 7, 2016 22:48:18 GMT
Hi, for some of my sounds, I have to add a basic get.component line to a general script that is added to several prefabs (character dying). So basically on the prefab i have an empty field where to assign a sound (can only be asset, not MA sound group) Is there a way I can add to the DarkTonic.MasterAudio.MasterAudio.PlaySound(DeathSound); for it to tell it to play to a bus (SFX) that I created in the MA prefab? Hope that makes sense. Like, DarkTonic.MasterAudio.MasterAudio.PlaySound(DeathSound) bus="SFX"; sorry i'm a terrible programmer but I love MA EDIT: Or, if there's a way to add a script to these prefabs that will route all audio attached to the MA mixer, that would be great. In the way you add an empty Unity audio source just to route to a bus.
|
|
|
Post by DarkTonic Dev on Dec 7, 2016 22:53:16 GMT
You can route a SoundGroup to a bus via code prior to playing it. However you can also assign the Sound Group's bus before hitting play. Why would you want to change it?
I would caution against using any AudioSources directly as Master Audio can't know about them. This will interfere with features such as auto-prioritization.
|
|
gabec
New Member
Posts: 16
Posts: 16
|
Post by gabec on Dec 7, 2016 22:56:07 GMT
I don't think i'm doing a good job explaining it. Basically the only way I can attach this particular sound is through native Unity. So there's characters, and a "death" animation script that I'm putting in a blank public field to add a specific death sound for each one. So on the prefab I can pick that, but it's all done outside of MA, and i'd like to route that sound back into MA's bus
|
|
gabec
New Member
Posts: 16
Posts: 16
|
Post by gabec on Dec 7, 2016 22:57:40 GMT
Ah I just saw your last sentence, i think i'll have to find a smarter way to go about this, thanks for your reply!
|
|
|
Post by DarkTonic Dev on Dec 7, 2016 23:04:43 GMT
You can add a public string variable to that script and decorate it with [SoundGroupAttribute] so that you can select a SoundGroup from the Inspector. Then just add a line of code in the script to play that Sound Group. Or even easier, just attach EventSounds script and use Disabled event to play a sound. Dropdown will already be there.
You might also look into using a Dynamic Sound Group Creator script if you need to populate temporary Sound Groups or "audio skins".
|
|
gabec
New Member
Posts: 16
Posts: 16
|
Post by gabec on Dec 7, 2016 23:06:51 GMT
Thanks so much i'll try this, makes sense! That's exactly what i'm looking for, I want to be able to pick a MA sound in the inspector
|
|
|
Post by DarkTonic Dev on Dec 7, 2016 23:11:42 GMT
No problem. You should probably watch the YouTube videos. They show this and a lot more. And they're short.
|
|
gabec
New Member
Posts: 16
Posts: 16
|
Post by gabec on Dec 7, 2016 23:52:04 GMT
I'm sorry can you point me to which video shows using SoundGroupAttribute? Can't seem to find it, just looking for an example in a script
EDIT: found it in the documentation, works, THANKS!
|
|
|
Post by DarkTonic Dev on Dec 8, 2016 1:43:57 GMT
It's the newest video, about the almost released Master Audio Multiplayer plugin. Check that sub forum here and there's a videos sticky post with the video.
|
|