Thanks so much. I didn’t understand it from Brackey but understood it from you
@vivekdesigner56015 жыл бұрын
same bro..
@MaruskaStarshaya4 жыл бұрын
Brackeys is a garbage, he make videos for views, not for sharing information, I avoid his vids.
@leosabou69754 жыл бұрын
fuck you then Maruha Starshaya
@UnknownPerson-nl7te4 жыл бұрын
@@MaruskaStarshaya truth is something else u never understand
@MaruskaStarshaya4 жыл бұрын
@@UnknownPerson-nl7te as you with english grammar, hahah
@VirtualTurtleGames4 жыл бұрын
Great video! Summary: Instead of using audioMixer.SetFloat("yourValue", sliderValue); use audioMixer.SetFloat("yourValue", Mathf.Log10(sliderValue) * 20); Easy fix :)
@PhotoMakers4 жыл бұрын
Thank you a ton!!!!!!! I had it all working before, except the logarithmic change! Works perfectly!!
@MarianSiwiak5 жыл бұрын
Thank you! Short, clear, to the point, and works as advertised! Cheers!
@ridlr92993 жыл бұрын
Is nobody gonna talk about how much of a banger that song is?
@JordanNeff-PGH3 жыл бұрын
Thanks John, exactly what I needed! So many garbage tutorials out there that don't go over using the mixer and you did it perfectly in under 10 minutes! Super helpful during a game jam :)
@NationOfBacon4 жыл бұрын
Really appreciate how easy you made this to understand without taking too long to explain. Thanks for showing a better way to do sliders.
@ReplayerTV4 жыл бұрын
So simple yet so forgoten about that decibel scale is logarithmic, thanks for your help, works perfectly.
@Delvarn3 жыл бұрын
I was having serious issues getting it working but followed this and.... bingo! Thanks a lot, the blog post about the dynamic float was super helpful too!
@Cooeewebdesign Жыл бұрын
I was really struggling to add a slider to control my volume until I watched this video, wow super easy. Great Video tutorial, simple and to the point 🙂
@VsevolodPankratov Жыл бұрын
I have tried various script options and only your method works fine in version 2021. And it also saves the settings perfectly. I subscribe to your channel.
@philunityunreal72284 жыл бұрын
Very nice and simple. I had issue with the Audio Volume in my project, i saw many tutorials which provided too many things. Your video is very basic and helped me much more than all other tutorials i saw. Thanks a lot and nice background music by the way.
@shadowgodthegamer57382 жыл бұрын
On point. I was looking for this kind of solution to the logarithmic problem
@mintydog062 жыл бұрын
Thanks, I didn't know about the Dynamic Float option, it's very useful.
@micaheberz60203 жыл бұрын
Thanks! Glad I learned it the right way from you first!
@JuanPablo-pt5gs2 жыл бұрын
It works, I forgot to say. But in the part of the event of the volume, when they ask for the object, use the script.
@SambinoDev2 жыл бұрын
Awesome! Always great when these tutorials are concise, thanks m8
@Erik-ki9ir4 жыл бұрын
Thanks for the help, just wanted to mention for those whose dynamic float still not working mine worked with the last script in his blog, replacing "MusicVolume" with your own Parameter name, place the slider object in the Inspector and place the Mixer in the Audio's FIle inspector if you have one.
@rodraix2 жыл бұрын
Thanks man! This video had help me a lot with a little game I'm working on. Keep doing this type of videos, they're interesting and helpful :D
@EVHlivesforever5 жыл бұрын
This tutorial is awesome man thanks so much! GREAT info for anybody making a menu system!
@MadeByJoey4 жыл бұрын
Thank you, John, for teaching me how to make a volume slider!
@sasquatchbgames2 жыл бұрын
this was fantastic, thanks so much! Implementing right now
@ChristopherReimschussel5 жыл бұрын
Love the tutorial. You made it easy and straight forward to understand.
@salmyismail85244 жыл бұрын
hye want to ask you using this setting making audio playing through all the scene?
@DrewVanCamp4 жыл бұрын
wow, thank you! very well demonstrated. always wondered how this conversion needed to be handled. it's somewhat black magic math to me, but it's such an easy solution. you're awesome.
@ConsideraCore4 жыл бұрын
Just for those who are wondering why you have to set the min slider to 0.001, it's because Log(0) is very bad, its undefined and will cause NaNs =)
@Merivio Жыл бұрын
Thumbs up from me! Quick and easy to follow!
@TheCodesnippet4 жыл бұрын
Simple and crystal clear, thanks for this tutorial man! And obviously I subscribed your channel !
@piedpiperplayz33634 жыл бұрын
thank you. This video helped me a tonne, I like the way you explain what you're doing as you do it. Keep it up my dude.
@BlackJar722 жыл бұрын
Well, -3 dB would be half the power and -6 dB half the sound preasure; Half the subjective loudness is -10 dD.
@theyourayclips76094 жыл бұрын
Bro, i want to ask you using this setting making audio playing through all the scene?
@ZacharyAghaizu3 жыл бұрын
Thanks, how do we make it so that the lower the number, the bigger the change. Basically inverse of this?
@noxmetrica352 жыл бұрын
Straight to the point, and very effective, thanks a lot!
@SaadTheGlad4 жыл бұрын
Can you please help me on this? Im trying to get my audio slider UI to persist between scenes. The value is stored and I am using PlayerPrefs but the slider doesn't change to fir it..
@sapphiretigress13 жыл бұрын
This is awesome! Thanks for the great tutorial :D This is my first volume slider and you explained it perfectly.
@squareff2555 жыл бұрын
GREAT video! Thank you so much! And thanks for that little workaround script on your blog! Works great!
@eloreneloreneloreneloreneloren Жыл бұрын
thanks I keep returning to this video
@TrentGallant2 жыл бұрын
Thank you! Awesome Tutorial!
@SpriteTheDude3 жыл бұрын
for impatient people just put this in the slider method mixer.SetFloat( "ExposedVariableName", Mathf.Log10(sliderValue) * 20);
@ryan_garfield2 жыл бұрын
mixer.SetFloat mixer.setFloat is invalid
@MrPotatoHQ3 жыл бұрын
Hi! I'm having some issues... I have my volume slider in my Settings scene, and the scene that my game starts up on is the main menu, so when I start the game, the music is full volume, but then when I enter the settings scene it goes to what the siders value is, I need help and don't know how to fix this. Thanks
@NemesisTWarlock3 жыл бұрын
Check the webpage in the desctription, it goes over and solves this issue.
@ForgottenRussian3 жыл бұрын
6:54 im having troubles linking the script to the slider. when I click the function on the "On Value Changed" area, it pops up with only "MonoScript", instead of "SetVolume"
@DheyssonSS3 жыл бұрын
create an empty gameobject and place the "SetVolume" script in this object, after assign this empty gameobject on the "On Value Changed". my english is very bad :)
@alejandrojimenez2144 жыл бұрын
Hi, slider keeps resetting its value every time I switch through scenes (I know I’m kind of late, but could you help?) This is my script: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.Audio; using UnityEngine.Experimental.UIElements; public class VolumeValue : MonoBehaviour { public AudioMixer mixer; public Slider musicSlider; void Start() { musicSlider.value = PlayerPrefs.GetFloat("MusicVol", 1f); mixer.SetFloat("MusicVol", PlayerPrefs.GetFloat("MusicVol")); } public void Setlevel(float sliderValue) { mixer.SetFloat("MusicVol", sliderValue); PlayerPrefs.SetFloat("MusicVol", sliderValue); mixer.SetFloat("MusicVol", Mathf.Log10 (sliderValue) *20+10); } } I copied someone else’s script that had the same problem here on the comments😅... no luck for me tho
@alejandrojimenez2144 жыл бұрын
Never mind, I just saw you website on the pin comment. THANKS!
@MaruskaStarshaya4 жыл бұрын
Simple, fast and understandably. Thanks a lot!
@handsomelessking3 жыл бұрын
did i do an update? idk, but that unity project just didn't work, i made another game since than, followed the tutorial 1 to 1 and it worked, so i don't know what was the problem
@howiey32424 жыл бұрын
was having this exact problem with my volume slider, thank you! :)
@bestdialogues76564 жыл бұрын
thank you so very much this is what I've been looking for.
@alexh16875 жыл бұрын
Yeah but what's the inverse function, to go from log back to linear (to display the current level for example) ?
@alexh16875 жыл бұрын
Thanks a lot ! @@JohnLeonardFrench
@muzboz4 жыл бұрын
Great tutorial, thanks John. I appreciate you making these things. :D
@kmtk824 жыл бұрын
Thank you SO much John, immensely helpful
@mikeshvedov69812 жыл бұрын
Thanks you a dude on the internet!
@tabooization1233 жыл бұрын
This is helpful and easily understandable. Thanks.
@ARTHUR145234 жыл бұрын
I believe you should make more videos from how to do thinks the right way in unity. Because I have some problems with the popular youtubers like Brackeys. They show you how to do it the easy way and not how to do it hte right way. In the beggining you say wow he is good because i learned how to do it easy. But in the future when you start to make your own serious games you might have problems. Thanks
@happytofu53 жыл бұрын
Thank you so much! Works like a charm 🧙♀️
@Chapali9a3 жыл бұрын
Works like a charm. Thank you very much.
@Ali-dl2wx2 жыл бұрын
I really loved it! simple and fast
@FreakyUptownGirl4 жыл бұрын
Hi, thank you very much for the video. Changing the volume works for my game, as long as I do not use the logarithmic scale. If I use the Log10-function it doesn't work any more. As soon as I change the value, the sound is completely turned off. If I turn the slider back to full volume, the music starts playing. What am I doing wrong? Thank you! Here is the code: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Audio; using UnityEngine.UI; public class SettingsMenu : MonoBehaviour { public AudioMixer audioMixer; public void SetVolume (float volume) { audioMixer.SetFloat("volume", Mathf.Log10(volume)*20); } it works this way: public void SetVolume (float volume) { audioMixer.SetFloat("volume", volume); }
@FreakyUptownGirl4 жыл бұрын
@@JohnLeonardFrench Thank you so much for your reply! This was indeed part of the issue. Another part was just a unity bug I guess. I noticed that while the music was playing, I did't see any peaks in the audio mixer. I solved it by unchecking and rechecking the "Audio Mixer Suspend" option. I discovered it by chance, so it was a little weird. But now it is working. :) Thanks for your support!
@purnabratakar71763 жыл бұрын
Hi there, i was wondering how the method gets the slider value while changing the audio level. Like there is no reference to the slider, yet the method knows the slider value. Please enlighten me
@Eryczeeeg034 жыл бұрын
I followed your tips and when i press a Play button music doesn't play. I have to go to settings menu and move in some directions a slider, then music start playing...
@sergiodeleon13714 жыл бұрын
Hey John French awesome video do you know if unity has fixed this issue?
@gamerito1002 жыл бұрын
How can I use this? I tried the same code, but it won't work on my slider, I think the compiler says it is wrong, but I don't know how to see what it is
@ARTHUR145234 жыл бұрын
Thanks a lot you are the best. How didnt i knew you so long. And i wondered why the slider was in the middle and the sound was almost mute. Can you please explain me how to set the sliders value = to the mixers? Because i have a slider in the main menu options, but in the game when you pause i have also a slider so you can set the volume in game. But it starts at full always. Thanks a lot again
@kirbeku31072 жыл бұрын
Great video, why do you type so loud?
@jerrys.lawson54182 жыл бұрын
Thank you that was amazing!
@Tbout724 жыл бұрын
Using audio source for the music was easy for testing the music volume. But if in my game in my scene I have a lot of objects with audio source each gameobject have audio source each one for another sound effect like door open or air condition or some engine how can I control them all with one slider to control all the sound sfx or how it called ? I want to add a second slider to control the sound effects volume so I can control the music and/or the effects sounds.
@Guddeisr4 жыл бұрын
Oh Thank you so much!! Pretty simple and clear!!
@rafaelresende54133 жыл бұрын
How to make the inverse, put the mixer value on slider?
@CowmasterStudios6 жыл бұрын
This works great! However, my slider keeps resetting its Value to "1" when I transition between scenes. How do I get it to retain its "value" between scenes?
@CowmasterStudios6 жыл бұрын
using System.Collections; using System.Collections.Generic; using UnityEngine.Audio; using UnityEngine.UI; using UnityEngine; public class SettingsMenu : MonoBehaviour { public AudioMixer audioMixer; public Slider musicSlider; public Dropdown resolutionDropdown; Resolution[] resolutions; void Start() { //musicSlider.value = PlayerPrefs.GetFloat("musicVolume", 1f); audioMixer.SetFloat("musicVolume", PlayerPrefs.GetFloat("musicVolume")); } public void SetResolution(int resolutionIndex) { Resolution resolution = resolutions[resolutionIndex]; Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreen); } public void SetMusicVolume(float musicvolume) { //audioMixer.SetFloat("musicVolume", musicvolume); PlayerPrefs.SetFloat("musicVolume", musicvolume); audioMixer.SetFloat("musicVolume", Mathf.Log10(musicvolume) * 20); } public void SetSFXVolume(float sfxvolume) { //audioMixer.SetFloat("sfxVolume", sfxvolume); audioMixer.SetFloat("sfxVolume", Mathf.Log10(sfxvolume) * 20); } public void SetFullscreen (bool isFullscreen) { Screen.fullScreen = isFullscreen; } }
@CowmasterStudios6 жыл бұрын
Ha! You're right, I did flip the line I meant to comment out! Great tutorial. Super clear and informative. Do you plan on doing more?
@CowmasterStudios6 жыл бұрын
@@JohnLeonardFrench As a quick addition to this one, could you show how to play a music/sfx blip every time you update the slider in-game? To help the user hear what their changes are actually doing.
@minesmr4 жыл бұрын
I have a question, I did the same exact thing as you told me to, but if I play the Scene the Sliderhandle goes to Zero, but the Volume is 100%, but if I click the Handle and drag it a little bit, the Music suddenly connects and gets very quiet, why doesn't it connect at the very start of the Scene Play ? Also btw. very well explained, understood everything! ;)
@minesmr4 жыл бұрын
@@JohnLeonardFrench Thank you, for the oppurtunity, it's very nice from you! I'm going to make sure, that I'll understand! ;)
@purnabratakar71763 жыл бұрын
I have the same problem where changing the slider value to 0 makes the game sound go to max
@iluWinter4 жыл бұрын
Super helpful thank you!
@steegosaurus5 жыл бұрын
This helped a lot. Thank you.
@rshum853 жыл бұрын
Great video, thanks!!
@fiyerooo15 жыл бұрын
Hi there, out of curiosity, how does Unity know to take the slider's "Value" as the parameter for the SetVolume function? Does it just assume that Value will be the dynamic variable that the dynamic float will be using, since that's like the 'main thing' of the slider?
@stefsteenvoorden15765 жыл бұрын
@@JohnLeonardFrench What do you mean exactly with: "when the function takes a single float parameter"? I'm currently having the issue of not being able to see the dynamic float option, and I don't understand why. (I have set the function to public ofcourse)
@diagolo92862 жыл бұрын
Really helpful, thanks a lot mate!!
@JLS_Media4 жыл бұрын
If you get any monobehaviour error make sure to copy the first 3 lines of code at the top exact as the same as his: using UnityEngine; using System.Collections; using UnityEngine.Audio;
@italianstyle76113 жыл бұрын
i don't understand, why do i have to use an Audio Mixer? To have a better volume management? I edit simply the volume of AudioSource/AudioListener
@plasmaint3 жыл бұрын
For example, you have different musics and sound effects. You can attach their audio sources to one mixer, one for the music and one for the SFX.
@italianstyle76113 жыл бұрын
@@plasmaint in my project I had like 2-3 audiosources to distinguish the SFX from background music. In each situation an audio source can play a specific clip with its own volume thanks to a Volume Manager script, Idk if it's the same thing...
@DayMoniakkEdits4 жыл бұрын
Is it possible to display the volume percentage ? I tried to figure out on my own but it wasn't a success xD
@DayMoniakkEdits4 жыл бұрын
Nevermind, I figured out ! Just add mathf.round(value *100) !
@schankwart08154 жыл бұрын
@@DayMoniakkEdits thank you, that helped
@dwexecutioner4 жыл бұрын
Thank you so much, I was looking for that.
@nachitengameplays41275 жыл бұрын
Duddeeee I get a spam of messages that says the following: UnassignedReferenceException: The variable mixer of VolumeController has not been assigned. You probably need to assign the mixer variable of the VolumeController script in the inspector. VolumeController.SetLevel (Single valorSlider) (at Assets/VolumeController.cs:12) UnityEngine.Events.InvokableCall`1[System.Single].Invoke (Single args0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:207) UnityEngine.Events.UnityEvent`1[System.Single].Invoke (Single arg0) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_1.cs:58) UnityEngine.UI.Scrollbar.Set (Single input, Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Scrollbar.cs:224) UnityEngine.UI.Scrollbar.Set (Single input) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Scrollbar.cs:207) UnityEngine.UI.Scrollbar.UpdateDrag (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Scrollbar.cs:304) UnityEngine.UI.Scrollbar.OnDrag (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Scrollbar.cs:354) Could someone help plsssss...
@sasakiluna4 жыл бұрын
Doesn't work for me have everything correct, looked 50x over the code and i use unity 2018.4.10f1. Any ideas why it doesn't work ?
@masterlewzilla21163 жыл бұрын
Works smoothly
@charlestheninja4 жыл бұрын
How can i set the value of the slider to start with the value of the audiomixer volume? I'`m having an issue changing scenes that when i open the settings menu the slider is showing up "100%" but the music is not with the volume in "100%" because i changed it previosly in another scene to another volume. I just can't figure it out the math to do the inverse maths. ;( Help me!
@gildedguy3 жыл бұрын
@@JohnLeonardFrench absolute legend
@kaushalmishra39014 жыл бұрын
Dynamic parameters option not showing in slider and drop down menu in unity. Can you help me out to solve this issue? I like your videos and I am also your subscriber. Thank you and help me out to fix this issue.
@Jester-8-bit3 жыл бұрын
does this work between scenes i must know
@Tbout724 жыл бұрын
Why when changing resolution in my main menu when running the game through the exe built file and not in the editor the whole ui elements get blurry and I can't click on buttons or change ui's elements liek sliders all I can do is click and change the resolution again and if I will change the resolution back to the default in my case 1920x1080 then it will not be blurry again and I will be able to click buttons and change sliders again ? This is a link for my question, But I can't figure yet what's wrong and how to fix it : forum.unity.com/threads/why-when-changing-resolution-while-game-running-using-the-exe-built-file-everything-is-too-blurry.787229/
@bensmith87234 жыл бұрын
at 6:26 when you save and exit the script, a little box called "Mixer" appears under "Script". when i did this that box didnt appear, and just to make sure i wasnt doing anything wrong i re-did it with the exact variable names and code you used letter for letter, but it still wouldnt work, so i was unable to connect the mixer to the script
@bensmith87234 жыл бұрын
so i solved the problem after about half an hour, turns out that a) i had a typo, b) i encountered the problem in your comment about the unity 2019.2.5 bug, so i used your blog to help fix it. thanks very much this was a very useful tutorial
@bensmith87234 жыл бұрын
@@JohnLeonardFrench thanks! was a great tutorial, easy to follow along, even if i did have to go back a second time to figure out where I went wrong, but it helped me learn a bit more about unity and c# scripts anyway.
@fadrdn4 жыл бұрын
Thank you, this tutorial helps me a lot! But there's a one problem. If I stop the game or go back to my scene where the slider at, it reset to value 1 even tho I already change it into 0.0001. Help?
@MattHassing3 жыл бұрын
if on awake you try to get the value of the slider with the .getfloat func and then set you're unity slider to that value then it'll save through scenes! unfortunately, you can't use this method to save to file though. this will look somewhat like this: using UnityEngine.UI; public Slider sliderVal; public float sliderpercentage; private void Awake() { musicmixer.GetFloat("musicVolume", out sliderpercentage); sliderVal.value= Mathf.Pow(10f,(sliderpercentage / 20)); }
@donkeylrp62823 жыл бұрын
@@MattHassing Man, I love you So much, Thank you
@ThiagoPrego Жыл бұрын
Thank you so very much. May the Lord bless you always.
@CHE6yp5 жыл бұрын
Thanx man, this was helpful!
@alomstw94303 жыл бұрын
I'm very much obliged to you.You helped me a lot
@nikolaallegro91785 жыл бұрын
Thank you, man! This was excellent!
@zackarygonzo20623 жыл бұрын
he smacks that keyboard harder than my mom slaps me
@cindyespindola49463 жыл бұрын
Great video thank you so much!
@NICKBRUTE4 жыл бұрын
Thanks! this was very helpful!
@MirageDreamer5503 жыл бұрын
So I created script and unity tells me that sliderValue doesn't exist and I dont have free space for audio mixer though i made it public pls help
@MirageDreamer5503 жыл бұрын
ok nevermind i solved it
@AlexB-go1nd5 жыл бұрын
Hey, I'm getting the error "Exposed name does not exist: Volume." Can anyone help me out?
@haachamachama73 жыл бұрын
Why not make the slider just range from -80 to 20 or 0? I'm not being snarky, I really don't have much experience with audiomixers, but making it range from -80 to 20 and start at 0 worked fine for my game, no need to log10 it.
@haachamachama73 жыл бұрын
@@JohnLeonardFrench Ah, I gotcha. Thanks for the reply!
@leabarrionuevo4 жыл бұрын
Hello! How are you? I need help. How can I access the "Mute" button from some UI button or togle?
@leabarrionuevo4 жыл бұрын
@@JohnLeonardFrench sure, just that my idea is to use 4 independent channels and mute one at a time, maybe calling the audiosouces components and ticking the mute cell can. it will work?
@leabarrionuevo4 жыл бұрын
@@JohnLeonardFrench it could work!! , I'll try. thank you very much for taking the time to answer me