|
Post by Rtyper on May 1, 2018 21:44:06 GMT
Hi,
I'm working on converting a project over to Master Audio and so far the plugin seems pretty great. My project makes use of multiple scenes being loaded at once - all the basic gameplay elements (including the Master Audio gameobject) are contained in a gameplay scene, and each level is in a separate scene that is loaded in additively. This causes a problem with the ambient sound component though, which only seem to play if they're in the same scene as the Master Audio component. I think the problem is due to loading order, is Master Audio doing some kind of detection/caching of these components on awake (which might be triggered before the other scene has loaded)?
Thanks in advance!
|
|
DarkTonic Dev
Administrator
Posts: 4,386
Posts: 4,386
Member is Online
|
Post by DarkTonic Dev on May 2, 2018 5:26:33 GMT
Hmmmm, I don't believe it is a loading order problem. AmbientSound script registers itself with MasterAudio game object in OnEnable. I put a game object that's disabled in the same Scene and many seconds later enable it, and I will see the "follower" for it appear under the MasterAudio _Followers sub-game object and I'll hear it if I go in range.
I haven't worked on multi-scene-at-once projects before, but I believe the problem has to do with the fact that it is multi-scene probably. Can you send me a sample project that loads another so I can debug and see if it's fixable? Or just point me to some code that loads another scene like you're doing.
|
|
|
Post by Rtyper on May 2, 2018 9:23:43 GMT
Sure, here you go: www.dropbox.com/s/080p5gxcgsjd65m/Master%20Audio%20Problem%20Demo.rar?dl=0After putting that together though, I think the problem is the other way around - Unity initialises everything in the active scene first. In my project, the level is the active scene because it contains the lighting data and skybox I want it to use, so the Ambient Sound scripts are initialised before the Master Audio component.
|
|
DarkTonic Dev
Administrator
Posts: 4,386
Posts: 4,386
Member is Online
|
Post by DarkTonic Dev on May 3, 2018 2:11:19 GMT
Well that's just not going to work. You will need to make sure there's a MasterAudio game object in the Hierarchy somewhere before AmbientSound scripts are enabled. If there aren't, you'll have to disable/re-enable them to register them...
|
|