A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Assets and Asset Store' started by dark_tonic, Jan 28, 2013.
Sure, I'll report as soon as this one goes out!
I need to ask something else...
Calling this returns "Object reference not set to an instance of an object" error.
But for example if I call "PlaylistController.InstanceByName ("PlaylistMain").CurrentPlaylistSource.name" from the same location it returns the name properly.. Bug or am I doing something wrong ? I'm trying the to do the following:
if (PlaylistController.InstanceByName ("PlaylistMain").CurrentPlaylistClip.name != "music_2")
PlaylistController.InstanceByName ("PlaylistMain").TriggerPlaylistClip ("music_2");
Do you have more than one Playlist Controller? If not, use the OnlyPlaylistController property instead of "by name". Also, I wanted to point out that it's the name of the PlaylistController, not the name of the Playlist, that you should be passing to "by name" if you use it.
Also, you should always check for null before accessing the name property because it is possible that the CurrentPlaylistClip is null (if there's no clip playing for instance). Let me know if that takes care of your issue or not.
CurrentPlaylistSource is just the AudioSource itself, so it can't be null. CurrentPlaylistClip is the audio clip in that Audio Source.
I do have two playlist controllers.
First one plays a short intro, when it's ended I start the second one which has 4 synced music clips that I move between depending on the level.
Name is correct it's the controller's name..
Then check for null and you're good.
Gotcha! Thank you...
Is there a way to access SoundGroup list from another gameobject and maybe populate a dropbox inside an inspector?
If playing sounds via code you cannot remember every sound group name...
Yes, use a string and the SoundGroupAttribute. Like this:
[SoundGroupAttribute] public string deathSound;
Thx it works.
Another question: would it be possible to loop a certain time range of a sound clip (or just the last part of the clip from a certain time)?
The sound is 2 min long and when it reaches the end it should always restart from 1 min.
That would be really nice.
Not without writing your own script currently. That feature is on the to do list, but not near the top. If you'd like to vote it up, go here:
While you're at it, vote for your most wanted features or let me know which you don't care about.
I'm having a problem with the PersistentAudioSettings. PlaylistController.Start (with Start Playlist on Awake checked) is being called before MasterAudio.Start so the music starts playing briefly before PersistentAudioSettings.RestoreMasterSettings is called to adjust the volume. Is there a way to ensure RestoreMasterSettings is called before the Playlist starts? I'm currently on 18.104.22.168.
Edit: Moving the call to the end of MasterAudio.Awake seems to fix the problem for me.
Cool, what exactly did you move? Can you send me a patch? I'll take a look and see if it looks like it will always work where you moved it to. If so, it will be updated.
I just moved the call to PersistentAudioSettings.RestoreMasterSettings from MasterAudio.Start to MasterAudio.Awake to ensure it was called before PlaylistController.Start (which starts the music). It doesn't seem to cause any issues. I'll send you a patch.
Thank you Mike.
Master Audio V 22.214.171.124 will be live in an hour (I'm in China, internet speeds are horrific). Changelog:
Fixed fake warning in Playlist Controller when you change Playlists and there's no Playlist assigned.
Fixed bug where putting bus or group volume at zero would still play audible sounds from random volume settings on the group's Variations.
Added validation checks to all Fade commands so that volume can't end up at NaN or infinite. If you send a volume other than between 0 and 1, an error will be logged and the command ignored.
Made the SoundGroupAttribute sort the Sound Groups alphabetically.
Fixed bug where PersistentAudioSettings initialization happened in Start instead of Awake, so Playlist volume would be non-persistent for 1 frame.
Fixed bug where a Playlist would not auto-advance if the 2 frames early check was missing due to excessive lag or a blocked thread.
By the way, our Core GameKit plugin is on a HUGE sale for $10 (normal price is $50) and can be found here: http://forum.unity3d.com/threads/re...wning-combat-variables-with-no-coding.167910/
It handles combat, pooling, spawning, game variables and much more with zero coding on your part.
Master Audio sale is over and back to full price.
Master Audio V 126.96.36.199 will be live in 20 minutes. Changelog:
Added a "Fire!" button during runtime in the Custom Events section for each event so you can fire it at any time.
Fixed bug: Caller Despawned Mode didn't work when the caller became inactive and not destroyed.
Fixed missing null check in ducking code due to recent bug fix.
Fixed bug where pausing a playlist would actually cause the song to advance to the next in some situations.
Added StartPlaylist method to PlaylistController, MasterAudio and EventSounds, which can be used to either change the playlist or restart it (it will figure out which one it needs to do).
Modified Behavior Designer task for StartPlaylistByName (and the Playmaker one too) to use the StartPlaylist method instead of ChangePlaylist so it works in every case.
Fixed bug where Unity 3.5.7 didn't compile with a recent change.
Changed UI, eliminated confusing icons and replaced with words (Add, Expand, Collapse).
Added 3 more Custom Event receive modes: never, within distance, beyond distance. Always is the old "existing" option and the default. This means you can make it so only receivers within a certain distance will actually receive.
FireCustomEvent method now takes an extra parameter of Vector3 (originPoint). You will need to provide this to compile again if you're calling the method.
Modified Behavior Designer "FireCustomEvent" task. Please re-import the BD package to get latest and compile again if you're using BD.
Modified Playmaker Custom Event "FireCustomEvent". Please re-import the PM package to get latest and compile again if you're using PM.
Is there a way to play sound, once button (uGUI 4.6) gets highlighted? Either with mouse, or with keyboard?
I intend on adding support for the new GUI events in Unity 4.6 when it's released, absolutely. Does anyone have a list of them?
Ah, I see, it is not there yet. You just have mentioned Unity 5 support, so I thought maybe 4.6 is already have got covered, but indeed, its is still in beta.
They are both in beta now. The reason I did 5.0 first is because that version has much improved audio capabilities. I'm sure that a lot of people wouldn't purchase if MA was thought to be needing an update plus time after Unity 5 was released. Thankfully, that's not the case!
Attention users: I will be traveling for the next 7 days. I will probably have zero internet access, so I will respond to any email / forum questions after that. Sorry it this keeps anyone waiting on answers. If Eric (DT) can answer any questions, he will. There were several bug fixes in the MA version released yesterday, so please update to the latest before reporting bugs.
Thank you and talk soon!
I'm using Master Audio with PlayMaker. I have four buttons set up. I have four clips set up in a playlist. I'd like to have it so that when I click the first button, the first clip plays, and if I click it again, it fades back out. When I click button 2, I'd like that one to play and so on. However, when I click any of them, only the first clip in the list plays even though I have the "playlist clip by name" with the specific clip on that particular button. (Regardless of which button I click and which clip I've told to play on MouseDown, it just plays the first one.)
I start the playlist at the beginning when the game starts and never stop it, but fade it in and out.
Sounds like a bug. Playing a song by name always works for me. Seen if you can make a small example project reproducing the problem and send it over to me to take a look please.
Hm didn't realize there was an update on Monday. I'll have to update and see. I might be using an older version of PlayMaker as well. I'll update both and see what happens when I get home and let you know.
Hm after some more tests, I realized that I was just misnaming the playlist clips.
However, it gave me no indication that they were named incorrectly.
The clip is called "Action (Tense 2)"
In the clip name, I called it "(Tense 2)" I know this was obviously user error, but it would've been nice for MA to put something in the console that said "hey, there's no clip with that name." or something. Just a suggestion. Maybe it does somewhere, but a PlayMaker error would be good too.
Sure, can you clarify what you did? Did you pass the name of a song that didn't exist in the Playlist?
Yes I believe I did do just that.
In the Master Audio Playlist Clip by Name playmaker action, I specified the correct playlist controller, but in the clip name, I just called (Tense 2) and not Action (Tense 2). So instead of saying "that doesn't exist) it just played the first thing in the playlist.
Also I have a suggestion.
It would be REALLY AWESOME if the sync groups have a setting for BPM. This would allow things on multiple paylists (or soundgroups) to play in sync with that sync group.
Imagine you have a song playing in sync group 1 in a playlist with a BPM of 130.
Now imagine that there are a row of coins in front of the player. Each coin plays a little "tick" sound when collected. So when the player runs and collects the row of coins, the ticks will happen on beat.
There could be an option to set how often the sound plays. 1/4th of a beat, 1/2 of a beat, 1/8th of a beat, and so on.
I think something like that would be REALLY cool. It could also be used so that you could build musical transitions so that before another part of a song plays, a little drum fill or something could come in oncue instead of just triggering before hand.
What do you think? I can explain it a bit more with some examples if you'd like.
Negative, I just tried that with Playmaker. It's already there! The yellow warning in the console says:
"Could not find clip 'lead2' in current Playlist in 'PlaylistControllerBass'.
If you don't see that, I can't reproduce your problem and you'll need to send me something that reproduces it.
This has been asked a couple times. It's not something I even know how to do given the extremely primitive API for audio in Unity, so it's on the "unlikely" list currently. You can go ahead and post any suggestions like these to the roadmap thread here: http://darktonic.freeforums.net/thread/87/feature-roadmap-master-audio-suggest
If enough people thing it's a great idea, I may move it up to the "likely" list and take another look at it.
Is there a way to get rid of (or conditionally use excluding mobile export) OnMouse_ event handlers?
Simply importing MA to an empty project and exporting to mobile with an empty scene causes following warning on the console:
I guess it's used in button clicker (which I'm using), right? I know it's just a warning but I would prefer a warning free export if possible...
Update, It was coming from EventSounds.cs, disabling the code section "#region Unity GUI Mouse Events" was enough the warning disappear... I'm not sure if that breaks something in my scene...
It could, depends on what you're using. What platform(s) do those warning appear for? It should be fairly easy to exclude the correct code if you let me know.
Thanks for the prompt reply. I'm seeing this for both iOS & Android export, warning posted to the console during build process... That might also be true for WindowsPhone but I haven't tested yet...
P.S. I'm on latest (4.5.4p1) Unity...
Thanks, I'll take a look for the version after the next.
I'm a complete noob with MasterAudio, really like it so far - just want to make sure I am about to use it correctly: I'm working on a first-person-shooter, my game will have several hundred, or even thousands of sound clips. Should I plan on having a single MasterAudio prefab which contains every single sound clip in my game and persists between scenes, or should I take a different approach? Is this discussed anywhere in the manual or somewhere I might have missed? Thanks in advance!
If you don't need to play music or SFX during a Scene change, just use a different MA prefab for each Scene.
Either way, make sure only frequently played sounds are set up by dragging in audio clips. Make infrequently played sounds use Resource Files so you don't take up too much audio memory from just audio. That's the approach we take in our games and it works well.
I'm trying to setup control to change the volume of the Playlist via Ngui slider. First step was easy, I just dragged Playlist Controller to Nguis UISlider notify field and it gave all the playlist methods available there. I guess I should have custom method for this but obviously I'm terrible coder. So, would it be possible to add method for changing playlist volume when using Ngui like this? Thanks in advance and for the great tool!!
UISlider notify field? We're still on NGUI 2.7 since they broke tons of things in our game with the 3.0 upgrade, so I really have no idea. That sounds like a newer feature
The method for changing Playlist volume that would work for you would be:
FadeToVolume. You could use a zero fade time so it will instantly set.
I'm thinking of just removing the "Fast GUI Refresh" option in the Master Audio prefab. It's a total CPU hog and the "normal" update is fairly fast already. Any objections? If not, it's gone the version after next.
Thanks for your quick reply! Ok, I'll check FadeToVolume. Other way I got some progress is to control Playlists audio sources with slider but still have problem because there is two audio sources and my slider controls only the first one, so every second song in the Playlist is working with slider I have to figure out in how to control both audio sources. Would you have any quick tip on that?
Hey Jerotas, could you write an example of using FadeToVolume?
I have this script and it works on Ngui slider and with my Playmaker setup but it's controlling all of the Playlists obviously.
voidOnSliderChange (float val)
MasterAudio.PlaylistMasterVolume = val;
How would I set up this to control only the Playlist I want with FadeToVolume or perhaps PlaylistController.PlaylistVolume?
Sure, do this:
Master Audio V 188.8.131.52 will be live in 20 minutes. Changelog:
Fixed bug where SoundGroupVariationUpdater would in some situations have a Null Reference error.
Fixed bug where TriggerPlaylistClip will play the same song twice in a row with auto-advance on before changing to the next song if that song is not looped.
Fixed bug where deleting a Playlist that's a starting playlist for any Playlist Controller will cause a startup error saying the Playlist can't be found.
Fixed bug where fading in a Sound Group right after playing a silent sound wouldn't play the sound audibly.
Moved the following methods in MasterAudioManager into MasterAudio class, and marked as public static, in case you want to do these from script for some reason: CreateMasterAudio, CreatePlaylistController & CreateDynamicSoundGroupCreator.
Added "Refill Sound Group Pool" to the Group Command dropdown on Event Sounds. This refills the random pool or sets a top-to-bottom Group back to top.
Added "Error on Duplicate Items" checkbox to Dynamic Sound Group Creator Inspector. Defaults to checked. If you turn it off, no errors will be logged for Groups, Playlists, Custom Events and Buses that already exist. They still won't be created. This is useful if you have more than one of the same Dynamic Sound Group Creator but don't want to see all the errors when you already created the items with the first one that spawned.
Added "Always Highest Priority" checkbox to Sound Group Inspector. This is only visible and working when you have Distance Priority turned on in the MA prefab. Checking it makes the priority of that Sound Group always highest priority (not calculated based on distance or clip age).
Eliminated warnings about mouse events for iOS and Android export.
Added songName parameter to ChangePlaylistPitch method, so you can change just one song's pitch if you like.
FadeOutEarly method of Variation no longer stops the audio automatically when the fade out is complete.
Added a set of checkboxes in a new Fading Settings section in Advanced Settings in the Master Audio prefab. There's a checkbox for each type: Variations, Groups, Buses and Playlists. Checking the box for that type means that audio in that type will be stopped if you have a fade that reaches zero volume (excluding automatic cross-fading of playlists). For example if you do a Fade on a Sound Group to zero volume, when complete, the Variations on that Sound Group will not be stopped unless you check this box. They will continue to play silently instead.
Hi users, I've hit a roadblock with the "save during runtime" feature. One user had sent me a link on some free code to use that would do that, unfortunately it doesn't work at all and is broken. So I posted a thread here:
And so far have zero answers after many days. So this feature probably won't see the light of day until I know how to actually do it. Anyone have any ideas or have seen another plugin that lets you save during runtime so I can look at the code?