Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved unity audio mixer exposed name does not exist on mobile

Discussion in 'Audio & Video' started by yusufyldz318, Sep 9, 2023.

  1. yusufyldz318

    yusufyldz318

    Joined:
    Jun 20, 2022
    Posts:
    15
    Unity version: 2022.3.5f1

    I am using sliders to change audio levels of subgroups of audiomixer. This was working fine in the editor and windows builds but I recently realized that this does not work on mobile. I have a logcat output like this:
    2023.09.09 12:35:08.159 16293 16331 Warn Unity Exposed name does not exist: SFX (UnityEngine.AudioMixerGroup)

    And the screenshot of my exposed parameter:
    https://ibb.co/K0VtCfn

    Here is the code i am using for setting volume.

    Code (CSharp):
    1.   static AudioManager s_AudioManager;
    2.  
    3.     static AudioUtility()
    4.     {
    5.         s_AudioManager = GameObject.FindObjectOfType<AudioManager>();
    6.     }
    7.  
    8.     public enum AudioGroups
    9.     {
    10.         Master,
    11.         Music,
    12.         Ambient,
    13.         SFX,
    14.         UI
    15.     }
    16.     public static AudioMixerGroup GetAudioGroup(AudioGroups group)
    17.     {
    18.         if(s_AudioManager == null) s_AudioManager = GameObject.FindObjectOfType<AudioManager>();
    19.  
    20.         var groups = s_AudioManager.FindMatchingGroups(group.ToString());
    21.  
    22.         if (groups.Length > 0)
    23.             return groups[0];
    24.  
    25.         Debug.LogWarning("Didn't find audio group for " + group.ToString());
    26.         return null;
    27.     }
    28.  
    29.     public static void SetVolume(AudioGroups audioGroup, float value)
    30.     {
    31.         if (s_AudioManager == null) s_AudioManager = GameObject.FindObjectOfType<AudioManager>();
    32.         AudioMixerGroup group = GetAudioGroup(audioGroup);
    33.  
    34.         float clampedVal = Mathf.InverseLerp(100, 0, value);
    35.         clampedVal *= -80f;
    36.  
    37.         s_AudioManager.SetFloat(group.ToString(), clampedVal);
    38.     }
    And this is Setfloat function in the s_AudioManager
    Code (CSharp):
    1.   public void SetFloat(string name, float value)
    2.     {
    3.         for (int i = 0; i < AudioMixers.Length; i++)
    4.         {
    5.             if (AudioMixers[i] != null)
    6.             {
    7.                 AudioMixers[i].SetFloat(name, value);
    8.             }
    9.         }
    10.     }
    And there is only one AudioMixer in the project.

    When I searched the internet i have came across with a guy had the same issue but he was using addressable where I don't. So the problem is not related to that.

    I also need to mention when i do this for "Master" it works. So the problem is only related to subgroups.


    I started to think that this is a bug. Is there anyone can help?
     
  2. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    290
    The first thing I would try is to log all the exposed parameters available to be sure that, for some reason, your "SFX" parameter is still there but with a different name.

    Code (CSharp):
    1. int numParams = mixer.parameterCount;
    2. AudioMixerParameterDescription[] paramDesc = mixer.GetParameterDescriptions();
    3.  
    4. for (int i = 0; i < numParams; i++)
    5. {
    6.     Debug.Log("Parameter Name: " + paramDesc[i].name + ", Type: " + paramDesc[i].type);
    7. }
     
  3. yusufyldz318

    yusufyldz318

    Joined:
    Jun 20, 2022
    Posts:
    15
    Code you posted is not for unity but unreal engine if i am not mistaken. Also i don't think unity supports getting exposed paramters via script. Correct me if i am wrong though
     
  4. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    290
    No sorry you're absolutely right, there is something like this you can do but only with internal code. Apologies for the confusion...

    This honestly looks like a bug in fact... I'm not aware of per-platform configuration you can make on the Mixer, unless you're doing them through scripts.

    Could you submit a bug report? This can be done directly from the Editor.
     
  5. yusufyldz318

    yusufyldz318

    Joined:
    Jun 20, 2022
    Posts:
    15
    Thanks. I have issued a bug report as you said. Hoping it will be fixed soon.
     
    SeventhString likes this.
  6. yusufyldz318

    yusufyldz318

    Joined:
    Jun 20, 2022
    Posts:
    15
    KalUnity3D likes this.