|
Post by FalseMC on Oct 2, 2019 20:16:58 GMT
Hi all, I am rather new to Master Audio and Unity in general and am currently unable to find a solution to a simple problem. I have 3 audio files that represent my game's menu music, one of which is an intro, the other two are loops that are intended to be layered. Ultimately I am only able to either 1) synchronize all three audio files, or 2) serialize all three.
Design intent is: - Audio 1 - play once and stop - Audio 2 and 3 - play in synch immediately after Audio 1, looping
Any help would be greatly appreciated. Thanks!!
~False
|
|
|
Post by DarkTonic Dev on Oct 2, 2019 21:00:56 GMT
Sure, so here's how I'd do it.
1) Set up audio 1 in its own Sound Group #1. 2) Set up audio 2 and 3 in separate Sound Groups #2 and #3. Set each of those 2 variations to loop in the Inspector. 3) Set up Linked Groups in Sound Group #1, to play when the variation stops, to play Sound Group #2 and #3.
|
|
|
Post by FalseMC on Oct 2, 2019 21:47:49 GMT
Ok, thank you! Was able to make some progress with groups (instead of playlists) but am running into 1 issue. The two loops arent perfectly in sync this way. It feels like the first of the two linked groups starts just before the second.
|
|
|
Post by DarkTonic Dev on Oct 2, 2019 22:05:55 GMT
That should not be the case as the code executes during the same frame, regardless of how many Linked Groups you have.
You may have a different compression type on audio 2 & 3 or other reason for the latency. In other words, the audio is told to play at the same instant, but it may start at a different time based on file type, compression settings, whether it's in a Resource File vs in memory, preload settings, etc. Compare the two and see if anything is different. There is no code to keep them synchronized or anything like that.
If it's identical, you'll have no choice but to try to compensate with a delay on the faster one.
|
|
|
Post by FalseMC on Oct 3, 2019 14:19:55 GMT
Thanks for the information. The assets are identical in compression and are set to stream load into the scene. I was able to solve my problem simply by checking the 'load in the background' box in the inspector. Cheers!
|
|
|
Post by FalseMC on Oct 3, 2019 15:43:18 GMT
This change results in the audio not persisting across scenes although the 'persist across scenes' box is still checked. Reading up on the docs it sounds like i may need Dynamic Sound Group Creators in other scenes. My MA prefab is in my Home screen which is revisited, so I may first move to a bootstrapper scene as mentioned in the docs. The decision to put it in the Home scene was to start the menu music should on that scene. I'll presumably need an Event Sounds component to start the music from the Home scene.
|
|
|
Post by DarkTonic Dev on Oct 3, 2019 15:50:56 GMT
Sounds right, about the Event Sounds.
You will probably need to use the bootstrapper otherwise when you go back to a Scene with a different Master Audio game object, it will be destroyed and you'll still have the one that is persisting.
|
|