giggsy
New Member
Posts: 3
Posts: 3
|
Post by giggsy on Dec 2, 2014 15:15:13 GMT
Hi! I've been skipping through the docs as well as the forum (here and over at Unity), but haven't found a solution to my problem. We have a one-scene based game. Our game has multiple levels though, which are all stored in JSON. So we re-initialize the one and only scene based on the data coming from the file. This is crucial, as we are creating a puzzle game with over 300 levels and don't want to create 300 unity scenes I basically figured out, how to create a music playlist via code. This works quite well: MasterAudio.Playlist playlist = new MasterAudio.Playlist(); playlist.playlistName = Config.PLAYLIST_NAME; MasterAudio.CreatePlaylist(playlist, false); MasterAudio.AddSongToPlaylist(... ); MasterAudio.AddSongToPlaylist(...); MasterAudio.StartPlaylist(...); ... etc.
But what I am struggling with is, how to do that for normal sound effects? I found some hints over at the Unity thread, but those seem to be outdated? Let's say I got multiple "themes". Each theme has 1 background music and 5 sound files. How can I only load the 5 sound files? If I have 10 themes, do you suggest dragging in all the 50 sound files into the scene? The sound files of each theme are "frequently" used. They are button click sounds ... so I guess they should stay in memory. But again, only the ones from the current scene. I hope you understand what I mean Right now, I fell back to managing the audio clips with native unity, which sort of eliminates the need for the plugin (except for maybe the music part). Thanks and greets!
|
|
DarkTonic Dev
Administrator
Posts: 4,384
Posts: 4,384
Member is Online
|
Post by DarkTonic Dev on Dec 2, 2014 17:20:02 GMT
Spawn a game object that has a Dynamic Sound Group Creator script on it. In the DSGC, assign only the sounds / music for 1 theme. When you want to do a different theme, despawn your game object and spawn a new one with a different theme. You don't need to use any code I believe Watch the new videos too, it might help a little. I show each thing briefly.
|
|
giggsy
New Member
Posts: 3
Posts: 3
|
Post by giggsy on Dec 3, 2014 7:53:03 GMT
Thanks for the reply. Just to make sure I understood you suggestion: this means a new/separate prefab for each theme, correct? 'Cause I didn't find any methods to assign the sounds to the DSGC via code. Sort of like you did in www.youtube.com/watch?v=dj7WYQ64jF0&list=TLEa-G4Z4sTXQ ?
|
|
DarkTonic Dev
Administrator
Posts: 4,384
Posts: 4,384
Member is Online
|
Post by DarkTonic Dev on Dec 3, 2014 17:24:05 GMT
Thanks for the reply. Just to make sure I understood you suggestion: this means a new/separate prefab for each theme, correct? 'Cause I didn't find any methods to assign the sounds to the DSGC via code. Sort of like you did in www.youtube.com/watch?v=dj7WYQ64jF0&list=TLEa-G4Z4sTXQ ? That is correct, make a different prefab for each theme. The Dynamic SGC prefab has 2 main uses: 1) Making a "sound skin" - like you're doing, where each version of it is the same Sound Group names, with different sounds - this is the original reason we made it for a customer. 2) Per-Scene sounds to save on memory when using a persistent MA game object.
|
|
giggsy
New Member
Posts: 3
Posts: 3
|
Post by giggsy on Dec 4, 2014 7:47:53 GMT
Thanks for the clarification!
|
|
DarkTonic Dev
Administrator
Posts: 4,384
Posts: 4,384
Member is Online
|
Post by DarkTonic Dev on Dec 4, 2014 8:10:39 GMT
Any time
|
|