Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Resolved help with setting up slider with mixer

Discussion in 'Audio & Video' started by aetztztztzzew, May 15, 2020.

  1. aetztztztzzew

    aetztztztzzew

    Joined:
    Apr 12, 2018
    Posts:
    39
    Hi! i hope this is right place to ask this question!
    I made slider that changes sound value and is connected to singleton soundManager
    script by onvalueChange(single) property
    Problem is i can change volume with it as long as i am on first scene(main menu), but when i leave that scene and return later to change volume i can move slider and slider value changes but volume is not affected.
    Any idea what should i look after?
    I dont think it will help but here is function i call by onValueChange event
    Code (CSharp):
    1.  
    2. public void setMusicLvl(float lvl)
    3.     {
    4.         mixerMaster.SetFloat("musicVol", Mathf.Log10(lvl) * 20);
    5.         PlayerPrefs.SetFloat("musicVol", lvl);
    6.     }
     
  2. valeriounity

    valeriounity

    Joined:
    Mar 23, 2020
    Posts:
    5
    Try this tutorial



    It helped me to change the volume with a slider and save the changed value through scenes
     
    aetztztztzzew likes this.
  3. aetztztztzzew

    aetztztztzzew

    Joined:
    Apr 12, 2018
    Posts:
    39