Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

[20% off!] Master Audio - AAA Sound Solution. #1 audio plugin on Asset Store!

Discussion in 'Assets and Asset Store' started by dark_tonic, Jan 28, 2013.

  1. zingaing39

    zingaing39

    Joined:
    Feb 11, 2014
    Posts:
    2
    Thanks for ur help, I have another question:

    when i play some sounds at the same time, notice that performance drop too much, i attacked profiler below:

    $Screen Shot 2014-02-12 at 3.18.13 PM.png

    I read ur code and see that u 're using SortedDictionary and SortedList, when u call function ContainsKey, it will very slow that will causing framerate drop down on mobile, plz double check if u can use building array or list to increase performance

    #if UNITY_WP8 || UNITY_METRO
    private static SortedDictionary<string, AudioGroupInfo> audioSourcesBySoundType = new SortedDictionary<string, AudioGroupInfo>();
    #else
    private static SortedList<string, AudioGroupInfo> audioSourcesBySoundType = new SortedList<string, AudioGroupInfo>();
    #endif

    thanks
     
  2. cloudcamaleoniv

    cloudcamaleoniv

    Joined:
    May 17, 2013
    Posts:
    57
    So, I have a prop object - a circular saw object that keeps spining and playing a loop sound, this sound is a 3D sound, that increases as the player (with the audio listener) gets close.

    When the saw is created, it plays a sound. It works great with the Event Sounds component.

    But when I create TWO objects from the prefab, just one of them is playing. The other is not. How may I attach the same sound to two (or more) different gameObjects?

    Thanks.
     
    Last edited: Feb 12, 2014
  3. mbreitkreutz

    mbreitkreutz

    Joined:
    Dec 4, 2013
    Posts:
    23
    I've noticed a problem with fading sounds causing an infinite loop. When I call MasterAudio.FadeOutAllOfSound(group, fadeTime), SoundGroupVariation.FadeOutEarly never exits the loop because _audio.isPlaying is always true, even when the volume is 0. Presumably, this same behavior occurs in the third loop of SoundGroupVariation.FadeInOut. This also sometimes causes artifacting if I fade several sounds at the same time. I can work around this problem by using MasterAudio.FadeSoundGroupToVolume(group, 0, fadeTime, delegate() { MasterAudio.StopAllOfSound(group); }) but it would be ideal if FadeOutEarly/FadeInOut didn't get into infinite loops. I've changed both loop conditions to include _audio.volume > 0 to eliminate the problem for now.
     
  4. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    I would guess that you have kept the default weight of 1 for your Sound Group's Variation. That means a maximum of 1 of that sound effect can be played simultaneously. Up the weight to the maximum number of voices you need for that effect.

    And please watch the video in the OP. It explains this and is quite short :)
     
  5. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    Ok thanks Mike. I'm not clear on the exact steps to reproduce the problem. Please let me know and send me your patch as well if you could.
     
  6. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    that was changed to sorted list and sorted dictionary for a user with a strange use scenario.
    I think the time has come to end that compatibility in favor of performance. I will make it so.
     
  7. xikky

    xikky

    Joined:
    Dec 11, 2012
    Posts:
    47
    I cannot find out how to play sounds without being interrupted. I am noticing that when a button is pressed twice fast, only the first click triggers the sound effect. Can a sound be triggered on each call rather then on a call during which the same sound is already playing?
     
  8. zabrams

    zabrams

    Joined:
    Oct 14, 2013
    Posts:
    2
    I'm getting the following error:

    I have a playlist controller that's in our setup scene (along w/ the master audio prefab), seems to persist across scenes just fine, and I don't see anything in our calls that references a blank playlist controller name. We also just upgraded from 3.0(?) to 3.4. Everything seems to be working fine, so I'm not sure what's going on, but I'd like to get rid of the error... any ideas?
     
  9. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    Again, you must have left the weight of the Variation at the default of 1. That means a maximum of one instance of that sound effect can be played simultaneously. Increase the weight property.
    Also please watch the video which explains this. Its very short.
     
  10. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,448
    Hey Jerotas! I've enjoyed being able to 'modify' existing sound effects to create variations without the need of more audio files, so now I'm wondering if you had any plans to increase the scope of this?

    Right now I'm merely using 'Random Pitch', and you do have six filter effects but perhaps you have more planned? Maybe? :D

    Thanks man!

    -Steven
     
  11. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    I looked at my 3D settings and the Audiosource associated with my Sound Group clip was set to 1 and the one associated with my playlist was 10, same difference though, which when both set to 1 did fix my problem. Seems to make sense to have them the same..

    If it's another way to fix this problem, how can I make Unity3d ignore 3D sound? I don't see it in a setting anywhere.?

    EDIT: Also I think another bug. This occurs when I've added a new sound into the GroupMixer and click the speaker icon to hear it. I found if I go deeper into the scene hierarchy and play the same sound by clicking on it's speaker icon, I do hear the sound and if I go back up and again click the speaker icon for that same sound within the GroupMixer, the sound plays fine and no error occurs.

    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[SoundGroupVariation].get_Item (Int32 index) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    MasterAudioInspector.OnInspectorGUI () (at Assets/DarkTonic/MasterAudio/Editor/MasterAudioInspector.cs:671)
    UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty)
    UnityEditor.DockArea:OnGUI()


    Thanks
    Jim


     
    Last edited: Feb 12, 2014
  12. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    It should work if you type the name of the PlaylistController into the EventSounds component you're using. I believe this is necessary when you don't have the Playlist Controller in the Scene. I'll see if I can make it work automatically without entering the name if there's only one Playlist Controller.
     
    Last edited: Feb 12, 2014
  13. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    Those actually aren't my filter FX, they're built into Unity. I don't plan on making any of those, and I'm not sure if Unity will ever add others. Anyone know?
     
  14. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    Ignoring 3d sound is a per-Audio Clip setting. Go to the Audio clip, and in the Inspector and uncheck the "3D sound" checkbox, then hit apply. You will need to do this for each clip separately, unfortunately.

    I couldn't reproduce the bug you're seeing. Please give me exact steps to reproduce and your Unity version.
     
  15. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    I had grabbed multiple audio clips at once and added them to the SoundGroup, maybe that was the condition that caused it, but I'll play with it more tonight. I'm on the very latest MasterAudio on the latest OSX Unity Pro.

    Thanks for your help!
    Jim
     
  16. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    Ok, after you play with it more tonight and get exact steps, please let me know. Were you on the Sound Group's inspector? Or on the mixer? What was the bulk variaton mode etc. I've never seen that error myself.
     
  17. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    I had added them in bulk to the sound group's mixer inspector. When I tried to sample the sound from the mixer, it would not work until I went deeper into the scene hierarchy and played that sound via it's own speaker icon (within it's own custom inspector). Doing that seemed to make things work when I went back to the mixer. I could then hear the sounds and got no error. I then went and did this like 8 more times for all the sounds and everything was then working fine. Somehow, clicking on that sound icon, initialized something that needed to be initialized.
     
  18. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    I understand. I haven't been able to reproduce this at all though. I added bulk groups. What version of Master Audio (and Unity) are you on? I believe I fixed an error like this about a month ago.

    P.S. If anyone else has seen this error and knows how to reproduce it, please chime in!
     
    Last edited: Feb 13, 2014
  19. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    I'm using 3.4.1.2 on UnityPro 4.3.4f1 for OSX. I hope to spend time on this later this afternoon.
     
  20. Rirath

    Rirath

    Joined:
    Dec 5, 2013
    Posts:
    30
    Hey guys, just a little head's up / checking if I'm right. If I've missed something, do feel free to correct me - but when upgrading to the latest version I got this message:

    Hadn't seen that before. Correct me if I'm wrong, but PlaySoundResultAtVector3 and PlaySoundResultAtTransform don't seem to actually exist - do they? Seems like I need PlaySound3DAtTransform or PlaySound3DAtVector3 instead? Just checking.

    PlaySound3D still comes up in intellisense, which seems a little strange to me if it's obsolete -- but maybe you can't prevent that?

    Also in the tooltip popup on the functions, PlaySound3DAtTransform says it returns nothing while PlaySound3DAtVector3 returns a PlaySoundResult object. Is that accurate? I would have guesesed both return a PlaySoundResult and that it's PlaySound3DAtTransformAndForget that returns nothing.
     
    Last edited: Feb 14, 2014
  21. mbreitkreutz

    mbreitkreutz

    Joined:
    Dec 4, 2013
    Posts:
    23
    It looks like "PlaySound3D" and "PlaySoundResult" are just mislabeled in the error message due to some copying and pasting. The functions are all named "PlaySound3D..." now. And all the PlaySound*AndForget functions should return a PlaySoundResult while PlaySound* functions return nothing so the tooltips may be wrong; the code looks correct to me though.
     
  22. Jimww

    Jimww

    Joined:
    May 14, 2013
    Posts:
    63
    On OSX 10.8.5 with Unity Pro 4.3.4.f1, I started a fresh project with only MasterAudio 3.4.1.2 (would be useful to update the UI's version number to show fix updates). I opened the MasterAudio Window and used it to add a MasterAudioPrefab. I selected MA and locked the inspector. I dragged an aif onto the group mixer and clicked the audio icon next to the newly added audio file and got the following error:

    $Screen Shot 2014-02-14 at 9.06.45 AM.png

    $Screen Shot 2014-02-14 at 9.05.25 AM.png

    I then selected the new scene object child that MasterAudio created for the new audio and used it's audio Icon to audition the sound. It worked. I went back to the MA's group MIxer and auditioned it there and it now works. This sequence of events is easily and predictably repeatable for me.

    Jim
     
  23. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    First of all, I'm glad to hear you use the correct term "intellisense" instead of auto-completion. That's a pet peeve of mine :)

    Anyway, I seem to have mistyped there. Yes, the correct replacement methods are PlaySound3DAtTransform, PlaySound3DFollowTransform and PlaySound3DAtTransform. There are also "AndForget" methods for all those, which don't return a PlaySoundResult object. The rest do.

    My intellisense does correctly show a PlaySoundResult return object for all the non -"AndForget" methods...curious. I've updated the C# comments so the next version will have the correct intellisense. And no, I can't prevent the obselete methods from coming up with intellisense. Later I will remove them.

    I don't know what you mean by tooltip for the methods...
     
  24. Rirath

    Rirath

    Joined:
    Dec 5, 2013
    Posts:
    30
    Sorry, I still mean intellisense, just the additional info that pops up on hovering - see screenshot.
    Maybe it's a result of having upgraded Master Audio too many times or something strange.

    $Screenshot - 2_14_2014 , 9_17_04 PM.png

    Certainly not a big deal, just a few little things I thought might save you some headache later on. :)

    (Edit: I'm not seeing that screenshot... It seems to be in the system though.
    -> direct link

    The "Returns nothing." at the bottom right is what I was referring to.)
     
    Last edited: Feb 15, 2014
  25. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    Ok got it. I'll fix that. Thanks!
     
  26. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,041
    Hi,
    How do you control cross fading between playlists?

    Use case:
    Start scene with a play button, plays some into music.
    User presses play, into BGM fades out and play BGM fades in.

    if uses quits or loses and goes back to main menu into BGM plays.

    Both playlists under the same play controller with cross fade time of 0 as they are playing random seemless loops in sequence.

    But...

    I want the playlist switching to be slightly cross faded.

    Can't see the setting for this scenario.

    ty!
     
  27. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    Cross-fading between playlists uses the exact same cross-fade time setting. You'll have to change the cross-fade time to a positive number (not zero) before changing the playlist, probably by scripting it (one line of code).

    If you'd like a separate setting, let me know and I'll see if I can make one in the next version.
     
    Last edited: Feb 16, 2014
  28. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,041
    Last edited: Feb 17, 2014
  29. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    Master Audio v3.4.1.3 will be live in about 15 minutes. Changelog:

    • Changed the default 3D settings of SoundGroupVariations to match the other Audio Sources used by Master Audio for consistency.
    • Fixed bug with CoRoutine never ending with custom fade times and FadeOutAllOfSoundGroup called.
    • Fixed C# comments and intellisense for deprecated PlaySound3D methods.
    • Fixed bug where Auto-advance with 1 clip in a playlist tries to crossfade same song.
    • Fixed bug where resource clips in a playlist were not released auto-advance is turned off.
    • Fixed caching problem with Playlist Controller Inspector. It wouldn't always show the latest Playlists in the dropdown.
    • Fixed bug where extra Audio Manager RAM was used when MasterAudio Inspector is selected in Hierarchy (jukebox section).
    • Fixed bug where deleting a Sound Group from the Master Audio Inspector wouldn't remove the duck group.
    • Major performance increase in the code that makes the AudioUpdater follow (embedded AudioListener on caller triggers this).
    • Changed list of sound sources back to Dictionary (performance increase).
    • As a side effect of the item above, all PlaySoundByIndex methods are removed.
    • Made EventSounds playlist controller functions with no Playlist Controller name specified "just work" if there's only one Controller, in a Boostrapper Scene configuration.
    • For Unity 4 users, we have added a CustomPropertyDrawer attribute of "SoundGroupAttribute", so you can decorate public strings that are Sound Groups in your Inspectors like this: [SoundGroupAttribute] public string laserSound;
    • Added "Controller Sync Group" field to Playlist Controllers. It's optional and is a number 1-4. If you assign a number, then whenever a new song is played, it's time will be set to the first matching Playlist Controller's (with the same Sync Group and a clip playing) time marker. This will also help align layered Resource clips more precisely.
     
  30. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,041
    Logically the playlist cross fade time should be under playlist settings I think, or at least labelled Playlist crossfade.

    Playlists should be able to have crossfade set on an individual basis I think, as well as a start/stop fade amount.
    Fading a playlist in at start and out on stop is as common as having no fade between the loops within a playlist itself.
     
  31. Parallel_

    Parallel_

    Joined:
    Dec 9, 2012
    Posts:
    90
    I'm having no success setting volume, either playlist or group, from the playmaker actions. What am I missing? I'm on the latest version, having a slider control a float from 0 to 1, putting that as volume. The playlist is set to play on awake.

    Edit:got a playlist volume control to work from a 'set property' on the clip within the playlist controller, but still not from the official playmaker action, so I'm guessing it's a setup thing.
     
    Last edited: Feb 17, 2014
  32. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Hi Jerotas,

    I think your plugin is awesome and I just started using it so I got a few questions, but only one that worries me, which I believe should be simple.

    Im developing for mobile and struggling with memory usage, trying to keep everything as low as possible to be able to load all the stuff I need, so I've been using a lot the Dynamic Sound Group Creator, to load only what I need. What I am struggling with is music. I have several Menu scenes, and several game scenes too. What I want is for the same music to keep playing in a loop for some of the menus, another music for other menu scenes, and another music for the game scenes, but I don't want to have all of these loaded up at the same time. If I just use one playlist and master audio prefab that persist across scenes, all "3" tracks would be loaded in memory right?

    In another words, lets put it this way. I have the game theme music, on the main manu and "character selection" screen. Then, based on the character, I have a character music playing, for all his menus (skill tree, inventory, etc), then, based again on character, each level has a different song. Problem is there will be at least 20 tracks, and having 2 loaded simultaneously is already something I want to avoid.

    Which would be the best approach to achieve this results with the least possible amount of memory usage?

    Thanks for your time,
    Best regards,
    Allan
     
    Last edited: Feb 17, 2014
  33. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    Ok, I'll see what I can do in that regard.
     
  34. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    You can either just make all your music stream, or put them all into Resource folders (for the latter, set Audio Origin to "Resource File"). Both are supported out of the box with zero coding for you. Streaming takes up near zero memory, while Resource Files are loading into memory as you need them, them the memory is released when you aren't playing it anymore. Master Audio handles this for you.
     
  35. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    I just tried both the Playlist Set Volume and Group Set Volume custom actions, and they both work for me. Did you get any errors?
     
  36. Parallel_

    Parallel_

    Joined:
    Dec 9, 2012
    Posts:
    90
    I get a warning, for my only Bus control and Playlist, despite them being played on awake (also possible with PM), and being able to mute them with PM actions, but no volume setting is possible, whether on master, playlist, group or bus:

    Some screenshots attached, maybe there is some error in setup?
     

    Attached Files:

  37. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    The warning you get is not from the Playmaker stuff you've set up. There's an EventSounds script in your scene that's set up to play a non-existing Sound Group "Thelist". Find it and delete it.

    As far as the Playmaker stuff, it looks correct to me. Note that you can't call any Master Audio methods until Start. If you wish to send me your project I can figure out what's wrong (use filemail.com, it's free - to support@darktonic.com).

    Actually, posting a picture of the FSM might be helpful.
     
  38. Parallel_

    Parallel_

    Joined:
    Dec 9, 2012
    Posts:
    90
    It had been deleted, but persisted anyhow, "Thelist" was supposed to be a playlist. Anyway I deleted the prefabs and started over, still no luck.

    It's a single state FSM, so what is above is what there is, save for the slider which is on another object.

    Thanks, but my project is >2 gb, but sent you a simple repro scene.
     
  39. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    The first thing I see is that you have 2 PlaylistController scripts on your Playlist Controller object in the Scene. Delete one of them. You must have added one, the prefab only contains one. I'll continue to look into this unless you tell me that resolves your issues.
     
  40. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    The 2nd problem I saw is that the Audio Listener is disabled.
     
  41. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    I no longer get any warnings or errors after fixing the previous two things. But your FSM does not work. If you open your FSM during play, you'll notice the Master Audio Set Volume action is always grayed out, because it has completed. The way you have the FSM set up, it only runs once, right when the Scene starts. Those GUI actions you have run continuously, but there's no "finished" event fired, so you can't simply move the Master Audio action into another state and hook up Finished. So I'm not sure how you need to fix the Playmaker FSM, but that is the problem. I don't use Unity GUI elements because they're dreadfully slow. So I can't help other than this. Thanks for sending the Scene, this should help you. If you need additional help on this, I'd post on the Playmaker forum. They should be able to help you figure it out.
     
    Last edited: Feb 18, 2014
  42. Parallel_

    Parallel_

    Joined:
    Dec 9, 2012
    Posts:
    90
    The disabled audio listener was a miss on my part before saving and I don't see 2 playlistcontrollers, if we're talking about the scene I sent you. I totally reconstructed the scene/problem with unity GUI to reproduce the slider setup as I usually use DFGUI. Just wanted to make it simple; a slider+float+set volume, that's it, a standard FSM setup AFAIK with no errors/warnings yet still no setting of volume. I don't see how sending the scene helped me. Maybe in the future when time allows you could include or build upon the playmaker example in your package, to demonstrate setting volume. Thanks for taking a look.
     
  43. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    It's one Playlist Controller with 2 of the same script on it (PlaylistController.cs).

    I think you're misunderstanding what I said. It is definitely helpful, it's just not the entire fix.

    You just need to know how to trigger a transition (to a different state) from your GUI State (where the volume change would be) with the slider in Playmaker. Simple as that. Please go ask on the Playmaker forum how to do this. I'm a beginner with Playmaker so I don't know the answer. The fact that it's a Master Audio custom action you want to trigger does not matter. i.e. if you wanted to do a (built in Playmaker) Camera Fade In action every time the slider was moved you would have the same problem - it would only happen once when your FSM first starts and not every time you move the slider.

    Bottom line, this is a intermediate Playmaker problem in your FSM setup, not a Master Audio bug (in fact the volume is set to .5 when the Scene starts by the custom action). I've taken it as far as I can with my limited Playmaker knowledge. My findings will definitely help you when you ask Playmaker forum people how to do it right.

    I am not planning on doing an example for this mostly because almost no one uses Unity GUI and my example would have to use it. Not immediately usable.
     
    Last edited: Feb 18, 2014
  44. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Hey jerotas, I am trying to do the following: I have a starter script for my scenes, which instantiates things I need asap, a bunch of stuff. This starter looks and see if there is or not a gameobject with the desired script, and if there is none, it instantiates it. This way I can test my game from any scene just by pressing play, dont have to start from the main menu for example. I am trying to make the same setup for MasterAudio... so I made a MasterAudio prefab with the options I want (including stay during scenes), made a playlist controller prefab with the musics I need that I also want to persist through the scenes, and then I look in the scene if the MasterAudio doesnt exist, instantiate my prefab, if playlistcrontroller doesnt exist, instantiate it, and then, after all is done, play the appropriate music with TriggerPlaylistClip.

    I do get the objects instantiated, but when I call MasterAudio.TriggerPlaylistClip("ClipName") it doesnt work, it tells me there is no playlist in the scene. However, if I click on the MasterAudio prefab that has been recently instantiated, it IS linked to the playlist prefab, I can actually play the clips on the inspector interface... is this not possible? I would like to not need to have to load a scene just to load masteraudio for the first time, and then go back to the scene I want to test...

    PS: If I set the playlist controller to play on awake, the music actually plays... but even this way, it thinks there is no playlistcontroller in the scene

    EDIT: I fixed it by simply changing this, in the PlaylistController.cs:

    From:
    Code (csharp):
    1. public static List<PlaylistController> Instances
    2.     {
    3.         get
    4.         {
    5.             if (_instances == null)
    6.             {
    7.                 _instances = new List<PlaylistController>();
    8.  
    9.                 var controllers = GameObject.FindObjectsOfType(typeof(PlaylistController));
    10.                 for (var i = 0; i < controllers.Length; i++)
    11.                 {
    12.                     _instances.Add(controllers[i] as PlaylistController);
    13.                 }
    14.             }
    15.             return _instances;
    16.         }
    17.         set
    18.         {
    19.             // only for non-caching.
    20.             _instances = value;
    21.         }
    22.     }
    23.  
    To:

    Code (csharp):
    1.  
    2. public static List<PlaylistController> Instances
    3.     {
    4.         get
    5.         {
    6.             if (_instances == null)
    7.             {
    8.                 _instances = new List<PlaylistController>();
    9.  
    10.                 var controllers = GameObject.FindObjectsOfType(typeof(PlaylistController));
    11.                 for (var i = 0; i < controllers.Length; i++)
    12.                 {
    13.                     _instances.Add(controllers[i] as PlaylistController);
    14.                 }
    15.             }
    16.             if (_instances.Count == 0)
    17.             {
    18.                 var controllers = GameObject.FindObjectsOfType(typeof(PlaylistController));
    19.                 for (var i = 0; i < controllers.Length; i++)
    20.                 {
    21.                     _instances.Add(controllers[i] as PlaylistController);
    22.                 }
    23.             }
    24.  
    25.             return _instances;
    26.         }
    27.         set
    28.         {
    29.             // only for non-caching.
    30.             _instances = value;
    31.         }
    32.     }
    33.  
    Just so it looks again for the playlist... the problem is that since the playlist is added after the init of MasterAudio, it doesnt register itself and MasterAudio do not look again for those playlists... and since I cant parent the playlist to the master audio prefab... had to force it to look again.

    Thanks in advance,
    Best regards,
    Allan
     
    Last edited: Feb 19, 2014
  45. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Hey jerotas,

    I am using the method above with Stream from Disc musics, but when changing scenes, music is fading out and restarting in the next scene. Is it possible to keep it playing?

    Thanks for the support!
    Best regards,
    Allan
     
  46. Parallel_

    Parallel_

    Joined:
    Dec 9, 2012
    Posts:
    90
    Ok, I see what you are saying that it only fires once and so needs to update from another state every time the slider value changes. I know how to do that, and have tried various methods with no volume manipulation as it stays greyed out as if it needs a 'deeper' reset than an event run through. Yet Master Audio's 'Master mixer volume' responds to the slider value. Playmakers inbuilt 'Set audio volume' works in a one state FSM, as it has an 'every frame' update bool on it, which is common practice for PM actions, and works straight away.

    Have you ever tried to do a working Master Audio PM setup (no extra scripts) that adjusts volume?
    Maybe there are other PM users here that could confirm that it works, and possibly how?
     
  47. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    I have set up a Master Audio PM, but it had no UI. It responds to events, such as mouse click, and adjusts the volume to say .25. Works fine.
    Good idea. We could try adding an "every frame" checkbox to the action you're using and see if it works then with the single state. Worth a shot. Let me do that in the next day or two. I'll add it to all of the actions actually.
     
    Last edited: Feb 19, 2014
  48. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    You could also drag your prefab of Master Audio + Playlist Controller into the Scene before pressing play. That's a workaround most people are using. Not good enough?

    Have you tried Instantiating Master Audio, then Playlist Controller, and the other way around, to see if one of them works?
     
  49. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,131
    I'm afraid I'm going to need exact repro steps for this one. I haven't seen this issue. Are you saying it only happens with streaming music? Or does that not matter?
     
  50. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Well, I feel quite dumb now, it worked instantiating the playlist controller before instantiating the Master Audio prefab. I thought it would probably throw some errors doing it in this order, but, gladly, I was wrong =). And, you know... Im lazy =P if I can make it once through code, its better =P

    The above change was so effective that it corrected this problem as well =) music is no longer restarting from scene to scene. But, if you do want to investigate what was happening... just make a simple code instantiating the PlaylistController prefab AFTER instantiating the MasterAudio prefab, but have none of them present in the scene initially.

    Anyway, thank you very MUCH for the help =)
    Best regards,
    Allan
     
unityunity