Search Unity

AudioSource priority is not working.

Discussion in 'Editor & General Support' started by McMayhem, Mar 17, 2013.

  1. McMayhem

    McMayhem

    Joined:
    Aug 24, 2011
    Posts:
    443
    Hello,

    So I've been pulling my hair out for quite a while trying to figure out what's going on here. I've got an ambient music track(set to 2D sound), that is an AudioSource set to priority "0". According to the Unity documentation and every single thread I browsed while trying to figure this issue out, that should mean it doesn't get ducked by other sounds. I also have an audio source attached to my player where I play UI sounds like button clicks etc. That AudioSource (Also with 2D sounds) is set to priority "255". Every time a button click is played, it lowers the volume of my music track. I've tried IgnoreAudioListenerVolume and numerous other things, but have been unable to figure out why this is happening.

    Things I've tried:
    - Alternating between audio.Play() and just setting it to "PlayOnAwake"
    - Messing with the priorities of both AudioSources
    - Changing the compression of the actual sound files
    - Changing how the sound files are loaded ("Load from Disk"/"Compressed In Memory"/"Load From Disk"
    - Changing the music track to see if it's the actual file that's the issue
    - Switching from 2D to 3D sounds for both sources

    (I'd also like to point out these are the only two AudioSources in the scene, and I have double/tripple checked to make sure there is only one AudioListener)

    I understand that Unity is mainly a mobile developer(at least that's what I've been told) and so performance budget is a big deal, but I've never run into this "max simultaneous audio" issue in any other engine I've worked with. I'm wondering if it might be better just to write my own audio plugin?

    Either way, if I'm just being a complete plumb and glossing over an obvious answer, I'd be very appreciative if someone would point that answer out.

    Thank you!
     
    Slimmy likes this.