|
Post by rxmarcus on Jul 11, 2015 14:38:33 GMT
At some point the audio in our game stopped working.... I hadn't been paying great attention because usually I turn down my speakers to not have the game audio get annoying while working on it. I'm now trying to figure out why I can't hear any of it. In the inspector I can click the speaker icon and hear the sounds fine but when calling them using MasterAudio.PlaySound(....) in game no audio is heard.
We did upgrade to Unity 5 about a month ago, I also did just update Master Audio to the latest on the asset store today but didn't seem to fix anything. I saw someone else in the forum mention they had to rebuild everything when they had a similar problem? Is there anything I can do to get this working without having to restart from zero?
Thanks
|
|
|
Post by DarkTonic Dev on Jul 11, 2015 17:45:49 GMT
By the way instead of turning down your speakers, you could have muted the audio in the Master Audio game object.
It's one of 3 problems. I assume you're using 3D audio, not 2D?
1) The Audio Listener is too far away from all the audio, so you don't hear anything. Maybe it's on your "main camera" game object (the default) and it was moved further away from the action? 2) The max distance needs to be increased for all your sound effects. You can use an Audio Source Template to do this in bulk. 3) Check the "Mixer Spatial Blend Rule" and "Music Spatial Blend Rule" in the Master Audio game object. Spatial Blend controls 2D/3D or in between.
|
|
|
Post by rxmarcus on Jul 11, 2015 20:15:46 GMT
So I am using 2D audio, our game is 2D. So I have the Mixer Spatial Blend Rule set to Force 2D. I tried applying a larger max distance using the Audio Source Template, still no dice.... I added a Audio Listener to the Master Audio game object just for fun as well, but if I'm using 2D sound effects then distance doesn't matter right? I noticed in Unity 5 when I select audio files there isn't the option to specify if its a 2D sound or not, maybe that is the problem?
|
|
|
Post by rxmarcus on Jul 11, 2015 20:29:54 GMT
Hrmm, I did a test by making a empty game object with an audio source and a sound, having it play via script and that can't be heard during runtime either...... I'm really confused, seems like it'd have to be distance releated, but everything is close by and its set to Force 2D anyways.
Any other thoughts?
|
|
|
Post by DarkTonic Dev on Jul 11, 2015 22:09:47 GMT
So I am using 2D audio, our game is 2D. So I have the Mixer Spatial Blend Rule set to Force 2D. I tried applying a larger max distance using the Audio Source Template, still no dice.... I added a Audio Listener to the Master Audio game object just for fun as well, but if I'm using 2D sound effects then distance doesn't matter right? I noticed in Unity 5 when I select audio files there isn't the option to specify if its a 2D sound or not, maybe that is the problem? Hrmm, I did a test by making a empty game object with an audio source and a sound, having it play via script and that can't be heard during runtime either...... I'm really confused, seems like it'd have to be distance releated, but everything is close by and its set to Force 2D anyways. Any other thoughts? If you're in 2D then don't worry about the distance settings or any of that. Not applicable. 2D audio can always be heard at the same volume regardless of distance. Don't worry about selecting 2D or not in the Audio Clip or Audio Source. Unity 4 had it in the Audio Source. Unity 5 does it at the Audio Clip level, it's called "Spatial Blend". But Master Audio does that for you, so no need to look at that. Just set Music Spatial Blend Rule and Group Spatial Blend Rule both to 2D. That will make all your audio (that's in the Master Audio prefabs) 2D. If you create your own game object and put Audio Source and clip on it, you'd have to set the Spatial Blend to 0 (which means fully 2D). The default is probably not 0. If you set "play on awake" and don't hear anything, there's really nothing left to troubleshoot unless you have changed "Volume" on Project -> Audio Settings or something. I'd create a new project if you can't figure it out. If you hit play and don't have an Audio Listener in the Scene, you should get an error.
|
|
|
Post by rxmarcus on Jul 12, 2015 23:44:01 GMT
Alllright, well turns out that there was some code somewhere in my project that was setting the volume of the audio listener to 0..... So it was my bad all along. thanks for the suport anyways and hopefully this will help someone else in the future if they make the same mistake.
|
|
|
Post by DarkTonic Dev on Jul 13, 2015 3:06:00 GMT
Sure thing. Let us know if you have any other issues.
|
|