|
Post by gracchus on Oct 6, 2015 1:43:23 GMT
Currently using Unity 5.2.1, and MasterAudio 3.4.6
I'm changing music tracks on a persistent MasterAudio object before a scene transition. Everything's fine in-editor (no warnings), but TriggerPlaylistClip("new song") or ChangePlaylistByName("new list", true) don't seem to have any effect in a mobile build.
Has this come up before?
Cheers!
|
|
|
Post by DarkTonic Dev on Oct 6, 2015 2:28:02 GMT
No. We haven't heard of anything currently that happens on a target device and not inside Unity. Have you checked the XCode / Logcat log (depending on iOS/Android) to see if there's an error logged to help narrow this down?
|
|
|
Post by gracchus on Oct 6, 2015 3:03:45 GMT
Using logcat I see an error: "Could not find clip '02 - map scene' in current Playlist in 'GameMusicPlaylist(Clone)'.
Could it be it doesn't like audio tracks beginning with numbers?
More on my setup: I need persistent audio through all game scenes (shared music, sfx), and have an audio boot-strapper object in every scene. On Start() it searches for any PlayListControllers and MasterAudio objects, instantiates them if none are found. Each of these prefabs are marked persistent. This is so we have sound when developing, no matter what scene we're in. Like so:
if (GameObject.FindObjectOfType<PlaylistController>() == null) { GameObject.Instantiate(playlistPrefab);
}
if (GameObject.FindObjectOfType<MasterAudio>() == null) { GameObject.Instantiate(gameAudioPrefab); }
Anything there sound crazy?
Additionally - the track that's not working is an .mp3, but other music that's already playing is .ogg. Is there a problem swapping from mp3 to ogg ?
|
|
|
Post by gracchus on Oct 6, 2015 3:41:41 GMT
I've tried swapping out the track for a more friendly named .ogg , and I still get the same problem, so doesn't look like it's anything to do with filename or swapping from one format to another.
Also this problem only seems to happen when triggering a clip that was previously playing. eg. my playlist has two songs.
- game loads, instantiates audio prefabs, triggers song 1 - player changes level - level loads, triggers song 2 - player quits back to menu - triggers song 1, loads menu scene
in this case, logs say song 1 can't be found in the Playlist, but it's previously been triggered successfully!
|
|
|
Post by DarkTonic Dev on Oct 6, 2015 5:33:08 GMT
Using logcat I see an error: "Could not find clip '02 - map scene' in current Playlist in 'GameMusicPlaylist(Clone)'. Could it be it doesn't like audio tracks beginning with numbers? More on my setup: I need persistent audio through all game scenes (shared music, sfx), and have an audio boot-strapper object in every scene. On Start() it searches for any PlayListControllers and MasterAudio objects, instantiates them if none are found. Each of these prefabs are marked persistent. This is so we have sound when developing, no matter what scene we're in. Like so: if (GameObject.FindObjectOfType<PlaylistController>() == null) { GameObject.Instantiate(playlistPrefab);
}
if (GameObject.FindObjectOfType<MasterAudio>() == null) { GameObject.Instantiate(gameAudioPrefab); } Anything there sound crazy? Additionally - the track that's not working is an .mp3, but other music that's already playing is .ogg. Is there a problem swapping from mp3 to ogg ? Well, that's one way to do it, but it doesn't appear to be working, at least on your mobile device. So I would advise you to do it the way suggested in the link below (2nd to last bullet point). Meaning: actually put a copy of the persistent Master Audio and Playlist Controller game objects into every Scene. No need for the code above. dl.dropboxusercontent.com/u/40293802/DarkTonic/MA_OnlineDocs/BestPractices.htmThat should work.
|
|
|
Post by gracchus on Oct 6, 2015 5:58:33 GMT
Interesting. Thanks for that, I'll let you know how I go Cheers
|
|
|
Post by DarkTonic Dev on Oct 6, 2015 6:02:10 GMT
Sounds good!
|
|
|
Post by gracchus on Oct 6, 2015 6:40:26 GMT
Nope, I don't think that's going to fix. Cool to know MA can do that though.
I tried without any dynamic creation, added a splash scene which contained a persistent MasterAudio and PlaylistController class. Disabled my boostrapper stuff.
Same behaviour - just doesn't trigger the original track when entering a scene. *scratches head*
I'm firing off music like so:
void Update() { if(!hasInitMusic) { hasInitMusic = true; MasterAudio.TriggerPlaylistClip(mySong); } } Each scene has one of these objects. I put it in the first frame of Update() just to be sure that all audio stuff would have been initialised already. Kind of like LateStart() .
|
|
|
Post by DarkTonic Dev on Oct 6, 2015 15:44:02 GMT
You have put the same persistent MA & PC game objects in each Scene? Your new "best practice" implementation still works in the editor, but not on device?
If so, I have no other suggestions. You're going to need to send me a small project that reproduces the problem. Although since it doesn't happen in the editor, I may not be able to solve it.
|
|
|
Post by gracchus on Oct 7, 2015 0:15:51 GMT
OK - I've made a little demo project which shows the problem.
Could you PM me an email address and I'll share the project and a compiled .apk.
|
|
|
Post by DarkTonic Dev on Oct 7, 2015 3:39:06 GMT
OK - I've made a little demo project which shows the problem. Could you PM me an email address and I'll share the project and a compiled .apk. Send to support@Darktonic.com Of course make sure to give me the steps to reproduce the problem.
|
|
|
Post by gracchus on Oct 7, 2015 4:18:02 GMT
Of course make sure to give me the steps to reproduce the problem. I've just shared it with you. It should be pretty simple to see what's going on. there's jut 3 scenes, a bootstrap load scene, scene 1 and scene 2. 2 different music tracks. Bootloader should be silent, scene 1 should play track 1, scene 2 should play track 2. UI buttons to move between the scenes. You'll see everything works fine when testing in -editor, but load up the compiled .apk and observed behavior is : - scene 1 plays track 1 - scene 2 plays track 2 - scene 1 plays track 2.
|
|
|
Post by DarkTonic Dev on Oct 7, 2015 6:14:12 GMT
Emailed you back. I need you to give thinkthat@gmail.com permission to download the file. My support email for darktonic is not a Google authorized thing.
Thanks!
|
|
|
Post by DarkTonic Dev on Oct 8, 2015 5:37:44 GMT
I've got the file. I've reproduced the bug in a PC Standalone export, which should be faster for me to debug. I'll post back when I figure out why this is happening. Thanks!
|
|
|
Post by DarkTonic Dev on Oct 8, 2015 6:15:16 GMT
I did a quick test with the latest version of Master Audio and the bug does not happen for me on the PC Standalone version in that case. I assume it will also be fixed on Android and other platforms. So I advise you to upgrade to the latest and it should be fixed.
Thanks!
|
|