Unity Slider in 4 Minutes - [Unity Tutorial]

Поділитися
Вставка
  • Опубліковано 29 гру 2024

КОМЕНТАРІ • 63

  • @ZOMGbies
    @ZOMGbies Рік тому +5

    You make objectively the best tutorials for Unity on UA-cam out of all the people I've seen. Concise and informative, and while there is no "right" way to do something - others so often showcase the wrong ways, non-performant solutions, or solutions that only solve a problem that has limited or no real world applicability.
    The only reason I ever use literally any other source is because I couldn't find the answer on your channel first. If you can fit it in, please ramp up the content schedule.

  • @nilsmuller-cleve6769
    @nilsmuller-cleve6769 3 роки тому +9

    Thanks for the hint with the broken call in the inspector.
    I just pulled up an old project and was wondering why all my sliders didn't work. Your solution fixed it.

    • @Tarodev
      @Tarodev  3 роки тому +4

      It's lucky I used a version of unity which was broken for the video 😂

  • @bpdhoplite
    @bpdhoplite 6 місяців тому +1

    Finally someone who uses the listener and doesnt just run a string in the update method ty

  • @maksedits933
    @maksedits933 3 роки тому +1

    BEST TUTORIAL ON SLIDERS!!!!!

  • @eldanridley7
    @eldanridley7 3 роки тому +7

    great video man. really helpful and straight to the point! also you explain really well :)

  • @rampaga7935
    @rampaga7935 3 роки тому +1

    THANK YOU!! I'VE BEEN SEARCHING FOR THE FILL INSTEAD OF STRETCH SOLUTION!

  • @IndicIndieGameDev
    @IndicIndieGameDev Рік тому

    I just wanted my slider foreground to not stretch, got the answer in 10 secs.
    Great video, thanks!

  • @codastudiode
    @codastudiode 2 роки тому +1

    dude, you're tips videos are awesome

  • @nguyenho9835
    @nguyenho9835 3 роки тому +4

    short and clear, love it !

  • @zhuoyuelyu
    @zhuoyuelyu 3 роки тому +12

    Clear and straightforward, thank you!

  • @EdLudington
    @EdLudington 2 роки тому +3

    Clear & concise. Thanks man!

  • @ABYZA
    @ABYZA 2 роки тому +1

    the on value change works just fine in my 2019 unity. just a reminder for everyone

  • @nullptr.
    @nullptr. Рік тому

    Thanks a lot, my custom fill was stretching and I couldn't understand how to change it until I found your video

  • @shashankmehta8126
    @shashankmehta8126 2 роки тому +1

    Can you tell us how you have added the Slider value?

  • @54egg
    @54egg 9 місяців тому

    Great video. Thanks. One thing that caught me was using the Slider's On Value Changed to call a method in my script where I selected a static parameter versus Dynamic Parameter. My function was being called on every slider change, but being passed 0 regardless of slider position, when I switched to Dynamic parameter everything worked.

    • @khurum
      @khurum 15 днів тому

      dynamic parameter means the Unity Event OnValueChanged is defined with a parameter, meaning we can receive a parameter from the event, So when you add a listener and find your script with the function it can either just trigger the function without passing in anything into the function which would then give a default value (0) for float as float is the parameter you need to receive, In the list of functions you can trigger it shows you the matching params functions as Dynamic Parameter, So once you select that it will now trigger it while also passing the parameter which is set by the slider when invoking the UnityEvent.

  • @mscottveach
    @mscottveach 3 роки тому +2

    great tutorial but one question: what's a slidau?

    • @Tarodev
      @Tarodev  3 роки тому +3

      They're only available in 'straya

  • @jamesxxxyz8775
    @jamesxxxyz8775 3 роки тому +2

    When i change slider text (TextMeshPro) change too. How can i save/load or update this text when i start the game again? Text is display as default. I save slider.value as PlayerPrefs.

    • @Tarodev
      @Tarodev  3 роки тому

      Yup so you could save it in player prefs, then in your start Functuon set the slider value to the retrieved player prefs

    • @jamesxxxyz8775
      @jamesxxxyz8775 3 роки тому

      @@Tarodev I tried different things, but If it didn't work (example v).

  • @racherim
    @racherim Рік тому

    Same, i've spent 3 hours changing and debugging my code and i can't get the inspector On Value Changed to work.

  • @codingidiot6754
    @codingidiot6754 2 роки тому +1

    do you know the exact proportions of the slider fill & background? whenever i try to put any texture into them, it gets stretched even if i turn the image type to filled

  • @jxw7196
    @jxw7196 2 роки тому

    Really really good man. Keep it up!

  • @sercansaglam2608
    @sercansaglam2608 Рік тому +1

    how can ı reach these sprites

  • @gavinguerette7466
    @gavinguerette7466 3 роки тому +4

    Can you explain the code please? I don't understand this syntax very well and can't apply this knowledge to my game. What is serialized field? How does this work being that the information is only called on the start method? (at the beginning frame). I see you made a reference but you don't really explain how it's updated and it seems very strange to code with curly brackets within functions.

    • @Tarodev
      @Tarodev  3 роки тому +2

      The serializedfield attribute allows the variable to be visible in the inspector while also remaining private.
      It works in start as we are subscribing to an event. You only need to subscribe once and can listen to it forever after that.
      The curly braces in the function is because the function is expecting a parameter of type Action, which is a function. Basically we are saying whenever this slider value changes, please run this code.

  • @sat.chid.ananda
    @sat.chid.ananda 3 роки тому +1

    Quick question, how can i make it so the slider.value resets to 0? i'm making an idle game and using a slider to show how much time it'll take to spawn things, and that's working fine...the first time around, then the value either goes back to 0 and DOESNT start the process of filling up again, or it just gets stuck in the max value and i cant get it to work

    • @Tarodev
      @Tarodev  3 роки тому +1

      Do you mean once the player lifts their finger you'd like it to go back to 0? The slider itself doesn't have a mouse up event specifically, but you could just hook into your average Input.OnMouseUp event and if the slider has a value you could just do _slider.value = 0;
      Hopefully I understood your question correctly :)

  • @lsdevelopment7055
    @lsdevelopment7055 3 роки тому +1

    How can I increase or decrease the speed of my object with the slider?

    • @Tarodev
      @Tarodev  3 роки тому +1

      You could use the sliders value as your speed variable in your calculations. Now there are a million ways to move something, but ill use the absolute simplest for this example:
      transform.Translate(Vector3.forward * _sliderValue * Time.deltaTime);

  • @Thaleans
    @Thaleans 2 роки тому

    Slider is not interactable in my game view, any opinions to fix?

  • @Guardabarranc
    @Guardabarranc 3 роки тому +1

    my slider does not work if I have it in my secondary canvas display 2

    • @Tarodev
      @Tarodev  3 роки тому +1

      Is it not receiving input? Could it be blocked by an invisible canvas element on the primary canvas?

    • @Guardabarranc
      @Guardabarranc 3 роки тому +1

      @@Tarodev I only have a canvas on screen 2, on screen 1 there is only one level. I have read a lot of document and can apparently work around it using a Rayscaster chart. What concerns me is that this information is from 2014. I don't know if this component is already included automatically when I add a canvas. Tomorrow I can check it. If I am very lucky and it does not add when doing it, it will solve it otherwise I will have to put buttons to add and subtract the values ​​since the buttons do work Thank you very much

    • @Tarodev
      @Tarodev  3 роки тому +1

      @@Guardabarranc good luck my guy!

  • @Dacommenta
    @Dacommenta 2 роки тому +1

    ripper video. Thanks

  • @luisalarcongames8756
    @luisalarcongames8756 2 роки тому

    great job mate

  • @gabonachohack
    @gabonachohack Рік тому

    How do I move an object with it?

  • @qwertyram4598
    @qwertyram4598 3 роки тому +1

    I remember I used the slider to make a 'health bar' on the UI, by just removing the knob and setting the slider's value to whatever I wanted it to be

    • @Tarodev
      @Tarodev  3 роки тому +1

      Yup, that's a very nice and easy way to set up a health bar. You can also attach it to the actual player object by making the canvas 'world space' and parenting it to the player

    • @qwertyram4598
      @qwertyram4598 3 роки тому

      @@Tarodev I might do something like that for the enemies, but frankly, I'll finish my Python project first before getting into a strict typed language again...

    • @Tarodev
      @Tarodev  3 роки тому

      @@qwertyram4598 good luck 😉

  • @leandrovasquezvega7621
    @leandrovasquezvega7621 Рік тому

    Thanks a lot!

  • @passiv_5602
    @passiv_5602 Рік тому

    Why does noone use UI Builder :( I cant figure it out

  • @gdenjoyr
    @gdenjoyr Рік тому

    Thank you

  • @noobcraft5712
    @noobcraft5712 3 роки тому

    Exactly 4 minutes gooooood.

    • @Tarodev
      @Tarodev  3 роки тому +1

      I'd never lie to you ;)

  • @AyyoNevNev
    @AyyoNevNev Рік тому

    amazing.

  • @jfanscryptojourney6038
    @jfanscryptojourney6038 3 роки тому +1

    Hi, may I know where to find the sprite u use for the fill area and background, and where can I find samples of those
    Doing a Unity School project at the moment and your videos really helped a lot.

  • @ralphryanamadaict1162
    @ralphryanamadaict1162 4 місяці тому

    How to save it when you exit the game

  • @retr0breezy
    @retr0breezy 3 роки тому

    can you revamp this. i didnt get anything at all

    • @Tarodev
      @Tarodev  3 роки тому

      What do you mean my guy?

  • @djcarryout27
    @djcarryout27 10 місяців тому

    Video needs the dimensions of the sprites

  • @arvidpingel
    @arvidpingel 2 роки тому

    He is the messias! Our saviour after brackeys disappearance

  • @Systemv1
    @Systemv1 Рік тому

    Handy; ty

  • @FAKKER_rap
    @FAKKER_rap Рік тому

    nice explanation without fkn rect transform shit that who knows how to tune

  • @lmzsource
    @lmzsource Рік тому

    typical

  • @null6209
    @null6209 Рік тому

    So it just doesn't fucking work THANK YOU, sorry for swearing, I've been battling for an hour until you said in your video that the slider value is just broken!