What I usually do is create a “Scripts” folder in Standard Assets and another one in Assets also. Then I drag the Scripts folder for the plugin under the right folder and rename “Scripts” to the name of the plugin. So you could have “Standard Assets/Scripts/Master Audio” with all the MA scripts there. Still organized! But yeah in two places. However hopefully you don’t need to mess around in the MA scripts much so it should be ok. The Editor scripts (for Inspectors) I think you want to keep up in Assets, but if that doesn’t work, move them too.
I’m working on some cool updates to the functionality. So far, I’ve got the following working:
- Inspector option for variations to either browse for clips as before or specify a filename inside a Resource file to load from.
- A method to change the clip used by a Sound Group variation, which can also load from a Resource file.
- A method to create a new Sound Group on the fly, using a clip in or out of a Resource file.
And I have an idea on how to make a prefab where you can specify Sound Groups to create through these new methods when the scene starts (or later) so that you don’t have to write any code but can be dynamic about things ![]()
Sound cool anyone?
Morning Brian!
Can I not use ‘this.transform’ to denote the transform to play the sound from?
My code:
MasterAudio.PlaySoundVariable("Metal_Impact11", this.transform, "", true);
Thanks man!
Actually it might not even be the transform variable.
I attempted to use another transform but that didn’t fix the error either.
If it’s not the transform, I have no idea what’s wrong, and while I don’t suspect it’s due to my moving MasterAudio scripts to /Standard Assets (as I have that exact same code in another GO, though I supply the transform rather than using ‘this’), I suppose I can’t rule it out?
Yes, that should work SteveB. I don’t think I can help any further through the forum with this particular issue. You’ll need to either email me a small project that reproduces the error (use filemail.com) or we can Skype. Let me know!
Submitted V2.7.2 to the Asset Store. What’s new?
- Added the ability to specify a clip in a Resource file for a Sound Group variation.
- Added methods to replace variation clips at runtime:
1.ChangeVariationClipFromResources
2.ChangeVariationClip - Added methods to create new Sound Groups on the fly, from Resource Files as well.
- CreateNewSoundGroup
- CreateNewSoundGroupFromResources
- Added DynamicSoundGroupCreator prefab to specify any number of Sound Groups to create on the fly. It can load sounds from Resources as well.
You can use this prefab (last item) and attach it to dynamic prefabs (say if a user selects an item to bring into the game) and create the Sound Groups dynamically. This was a user request!
Let me know what features you would like to see! I’m all out of things to put into the plugin now. Hope you enjoy the updates!
How do you detect if a clip is done? In my scene I have a character that starts a “Chat” animation and want to stop the animation once the voice-over is complete. Make sense?
Yes, that makes sense. There’s currently no way to do this. Implementing this for every single clip would definitely cost some considerable performance if you’re playing a lot of different clips at the same time. I will try and add a configurable way to do this and get back to you.
That would be great! If I could tell it to trigger a specific event or something when done… The main challenge is you may change the triggered event depending on when you call the sound. And as you said, my problem is there may be a dozen sounds going. If I only check for when there are no sounds going, it won’t do me any good.
Or, if it could return a handle I could poll… then I could poll it in my update function and know it was done.
I have a way to do this now. It requires code like the following:
var result = MasterAudio.PlaySound(“Scream”);
if (result.SoundPlayed) {
StartCoroutine(result.ActingVariation.DetectSoundFinished(this));
}
And then you just add this method to your same class to receive the message sent:
void SoundFinished(object soundGroupName) {
// do something!
}
This will be in the next update!
Note: Our support forum is going offline very shortly. For whatever reason, customers only post there about 1% as often as they do on this forum (and by emailing us), so we are getting rid of it. Narrowing it down to these 2 methods of support seems to be working fine!
Hi,
Been using this for a couple of weeks, it’s alright but missing some functionality we need.
I need to be able to adjust a groups volume while a clip from the group is playing and have the volume change affect the clip, also a GetGroupVolume(string sType) method would be handy.
Also I think theres a bug on line 567 of MasterAudio.cs
info.source.transform.position = sourceTrans.localPosition;
but I think it should be
info.source.transform.position = sourceTrans.position;
I will look into adding these things tonight. At first glance line 567 does look like a bug, I will test it out and make sure before changing it, thanks! If there’s anything else you can think of that would take this product from “allright” to awesome, do let me know.
V 2.7.2 is live, grab your updates!
Your wish is my command! V 2.7.3 submitted to the Asset Store. Changes are:
- Added the ability to be notified when a sound is done playing, so you can stop an animation or things like that.
- Added MasterAudio.GetGroupVolume to read the volume before modifying it.
- Adjusting bus volume will now immediately change volume of clips playing in that bus.
- Adjusting group volume will now immediately change volume of clips playing in that bus.
- Removed SetBusVolumeByIndex and GrabBusByIndex methods. They were not useful. Use the “by name” ones instead please.
- Fixed bug with positioning sounds.
- Moved the “create group” section into the top of the mixer section instead. More convenient.
Asset Store has already released V2.7.3, dayam they are quick lately! Grab yer updates ![]()
could you please add a feature to delay playing a sound.
like a passed variable of PlaySoundDelayed(), or even if its just set inside of the master audio components of the MA prefab.
instead of audiosource.Play you would just use audiosource.PlayDelayed
Sure, just submitted V 2.7.4 update to the Asset Store. It now provides an additional parameter for MasterAudio.PlaySound (and PlaySoundVariable) to set a delay before playing the sound. I also included this on the Playmaker custom actions and Event Sounds scripts.
These options are only visible and available in Unity V4.X+ since that’s when the method was created.
Bump to announce that “Master Audio Free!” has had an update submitted tonight, so it now once again includes everything in the full version. That means full Playmaker support!
It is limited to 6 Sound Groups, but everything else is unlimited and exactly the same. I will post again when the update is live.