techead
New Member
Posts: 15
Posts: 15
|
Post by techead on Nov 13, 2014 0:07:36 GMT
Hi, I'm using DynamicSoundGroupCreator to host my Music Playlist for that level. I also have a Master Audio prefab that has the shared SFX for the levels in the scene (not using Boostrapper)
I have a set of PlaylistController that I manually set Initial Playlist to the corresponding playlist. The PlaylistController are set to not load on awake.
I save the scene and then click on the Master Audio prefab then go back to the Playlist controllers and the Initial Playlist is now blank again. So the connection to the playlist has gone non of the music plays.
To get around this issue I have made my playlist controllers into a prefab. When I start the game I get this error.
Could not find Playlist 'ATM'. UnityEngine.Debug:LogError(Object) MasterAudio:GrabPlaylist(String, Boolean) (at Assets/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:3040) PlaylistController:FillClips() (at Assets/DarkTonic/MasterAudio/Scripts/Utility/PlaylistController.cs:632) PlaylistController:InitializePlaylist() (at Assets/DarkTonic/MasterAudio/Scripts/Utility/PlaylistController.cs:607) PlaylistController:Start() (at Assets/DarkTonic/MasterAudio/Scripts/Utility/PlaylistController.cs:134) Unity Version 4.3.4 Master Audio Version 3.5.6.4 Thanks
|
|
|
Post by DarkTonic Dev on Nov 13, 2014 0:29:58 GMT
You can't set the initial Playlist to one that's dynamic. That will not be saved into the Playlist Controller at all. You can only select from Playlists that are in the Master Audio prefab.
Your workaround will not work either. You will need to change the playlist when the Scene starts via code or an Event Sounds event (Start would be a good candidate).
Side note: if you set up all your music clips as Resource Files, you can just have one huge Playlist with every single song in the game. Only the currently playing song will take any audio memory. This would get around this problem completely because you wouldn't need to put the Playlist in the Dynamic SGC.
|
|
techead
New Member
Posts: 15
Posts: 15
|
Post by techead on Nov 13, 2014 1:00:26 GMT
Thanks for the quick response.
How in code can you set Initial Playlist?
|
|
|
Post by DarkTonic Dev on Nov 13, 2014 4:04:13 GMT
If you only have one Playlist Controller in the Scene, then it's:
MasterAudio.StartPlaylist("your playlist name");
Note that your code will need to ensure that it runs after the Dynamic Playlist is populated into the MA prefab from the Dynamic SGC prefab. To make sure, you might have to change Script Execution Order to make DynamicSoundGroupCreator.cs run before your script.
|
|