Search Unity

Audio SetFloat broken for new exposed Audio Mixer parameters

Discussion in 'Audio & Video' started by empika, Feb 15, 2020.

  1. empika

    empika

    Joined:
    Jul 12, 2012
    Posts:
    31
    Hey folks,

    Related to my thread the other day (https://forum.unity.com/threads/unmute-mute-mixer-group-api.828210/), I started to implement setting the volume on my music group in the build script, but it wasn't working. I've also had a recent bug where some groups would not fade out and upon investigating further it looks like the two are related?

    In the editor everything works correctly, but in builds (all platforms, tested on mac, windows and switch) half of my old exposed audio mixer parameters and any new ones no long respond to SetFloat. Calling GetFloat directly afterwards (and subsequent frames afterwards) reports the correctly set value but does not actually affect the property you are trying to change of group the group. Some old groups+params do respond correctly, but these have been working for years.

    I've tried creating new groups, a new mixer, upgrading unity from 2019.2.14 to 2019.2.21 (i'm just grabbing 2019.3 but am not hopeful and would rather avoid an upgrade until 2019.4). I've tried to isolate the code that calls the SetFloat as much as possible but no dice. The project is pretty old and has come all the way from 4.6, and it's getting pretty big so isolating something like this or even sending a bug report is pretty tricky.

    I've created a small test project but have been unable to reproduce the issue but I'll keep trying.

    This was working at some point and I'm unsure when it stopped working. I'm going to go back through my repo and try some old versions and see if i can pinpoint it.

    So, any ideas of what could be wrong, or any suggestions for further debugging?

    Thanks!
     
    Last edited: Feb 15, 2020
    hadesfury and Abrakam like this.
  2. hadesfury

    hadesfury

    Joined:
    Jan 23, 2014
    Posts:
    55
    We have the same kind of problems on unity 2018.4
    I did not succeed to create a repro project too :(
     
  3. empika

    empika

    Joined:
    Jul 12, 2012
    Posts:
    31
    Ok!

    So this was related to asset bundles.

    A mixer group referenced in a scene in an asset bundle will cause the mixer to be auto-included in the scenes asset bundle. When the scene is loaded it loaded the mixer in the asset bundle as a separate mixer instead of having referencing your main mixer.
    This was solved by putting the mixer in a common asset bundle and loading it in my bootstrapping scene.
     
    GrizzlyMrDan and mike6502 like this.
  4. hadesfury

    hadesfury

    Joined:
    Jan 23, 2014
    Posts:
    55
    Thank you very much ! I will try that

    [EDIT 1] It worked ;)
     
    Last edited: Feb 17, 2020
  5. empika

    empika

    Joined:
    Jul 12, 2012
    Posts:
    31
    Great, glad to hear it :)

    I guess I'm now stuck with wondering why I can't load a mixer from the assetdatabase and change settings in my build script :confused:
     
  6. hadesfury

    hadesfury

    Joined:
    Jan 23, 2014
    Posts:
    55
  7. duartedd

    duartedd

    Joined:
    Aug 1, 2017
    Posts:
    150
    i added my audiomixer to my addressable group
    loadedassetasync the audio from the Mixer AssetLabel
    and still not working on the windows build - only in editor
    gonna try to update to 2018.4.21f1
    updating didnt work - dont really want to go to 2019 since it isnt LTS
     
    Last edited: Apr 20, 2020
  8. HajiyevEl

    HajiyevEl

    Joined:
    Feb 19, 2020
    Posts:
    47
    Hello. I think i have same problem. I can SetFloat() in editor, but after build to android it doesn't work on device. Did you find the solution? Share please.

    Can you elaborate please? I'm newbie and don't understand anything =(
     
    Last edited: Jul 11, 2020
    davmessis likes this.