Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Audio volume slider works in editor, but not in Android device

Discussion in 'Audio & Video' started by mathiasbc04, Mar 18, 2023.

  1. mathiasbc04

    mathiasbc04

    Joined:
    Dec 21, 2020
    Posts:
    33
    I have three sliders in my game for controlling 3 audio mixers: Music, SFX, and UI. The Music and UI sliders works perfectly, however, the SFX slider only works perfectly in the editor. In my Android device, the audio is only affected in some scenes. In the scenes that don't work the audio is just reverted to 0 dB. This is the script I use which is controlled by the UI slider:

    Code (CSharp):
    1. public void CliqVolume(float volume)
    2.  
    3. {
    4.  
    5. audioMixerCliq.SetFloat("volume", Mathf.Log10(volume) * 20);
    6.  
    7. }
     
  2. Nvizzio_Steven_G

    Nvizzio_Steven_G

    Joined:
    Jan 24, 2023
    Posts:
    6
    I have a very similar issue. We have a bunch of mixers that are sub-grouped. If I change the volume of SFXVolume through code, only the sounds directly hooked to SFXVolume will have their volume modified, any sub group that are childs of SFXVolume will not modify their hooked sounds. This bug only happens on IOS / Android, in the editor it works fine. There are no errors.

    Unity version is 2021.3.5f1, this is pretty urgent and I have seen no answer to this problem on the internet.

    A note : Our AudioMixer (and groups) is not directly referenced, it is loaded from Resources, via AssetPath on the inspector. Its not an adressables. Could that be an issue?
     
    Last edited: Mar 18, 2023
  3. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    380
    Hi,

    Could you provide a minimal unity project reproducing this issue and submit a bug report? This is the best way for us to directly address your issue.

    In fact this rings no bell to me. I don't think loading the mixer from resources would be a problem, but then again it wouldn't be the first time weird stuff happens on mobile platforms...

    Thanks!
     
  4. SuperRaffles

    SuperRaffles

    Joined:
    Jul 25, 2019
    Posts:
    12
    Hi,

    Any update on this? I have the exact same issue. Also using subgroups of the mixer, being referenced directly, and accessed like this: masterMixer.SetFloat("MasterVolume", Mathf.Log10(volume)*20f );

    This exact setup worked perfectly in Unity 2019 on Android and iOS, but since updating to 2021 the code only works in the editor.
     
    Last edited: May 4, 2023
  5. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    380
    I dug a little and found that a bug report was submitted some time ago, but the issue was in the repro project rather than an actual bug, and so the case was closed.

    If you're still experiencing the issue, the way forward really is to submit a bug report. While we usually investigate the code surrounding a reported issue, it is obvious we can still miss things. If we find a way to fix the project to solve the issue, we tend not to linger to tackle the next one.

    Also, when we are aware that a workaround exists, it lowers significantly the priority of the bug.
     
  6. RayTerry

    RayTerry

    Joined:
    May 5, 2023
    Posts:
    1
    You can ask some Mod applications to help you with the most advanced audio enhancement software available today