Search Unity

Slider Event OnValueChanged() missing parameter.

Discussion in 'Editor & General Support' started by jeffweber, Sep 17, 2019.

  1. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Since updating to Unity 2019.2.5, my Slider event, OnValueChanged not longer takes a Single. This is preventing me from hooking into the Dynamic version of the OnValueChanged event.

    Ideas?

    From the Unity Docs:
    SliderDocs.JPG

    My Game:
    Slider.JPG
     
  2. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Bumping...

    Could someone else please drag a slider and then check in the inspector if the OnValueChange is showing a Single for a parameter or nothing?

    I feel like I'm missing something. I need to hook the slider into a handler that takes in the value of the slider but with the way things are currently, that is not possible. I guess I could hook it up in code and see if that event takes a single.
     
  3. Ozone_ABN

    Ozone_ABN

    Joined:
    Jan 11, 2014
    Posts:
    12
    Hi,

    same problem here. Seems to be a bug. I experienced this in 2019.2.5f1, 2019.2.6f1 and 2019.3.0b3 on MacOS. Using 2019.2.4f1 and earlier (on Mac and Windows) the problem is not present.

    To reproduce the bug:
    1. Create a new Project (3D or 2D)
    2. Add a UI/Slider in your scene
    3. Create a c# script (see below)
    4. Add Script to Slider
    5. In Slider script add a OnValueChanged-Function pointing to the Test scripts "OnSliderValueChanged(float value)" function
    6. In the dropdown there is no dynamic float option

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3.  
    4. public class Test : MonoBehaviour
    5. {
    6.     public void OnSliderValueChanged(float value)
    7.     {
    8.         Debug.log(value);
    9.     }
    10. }
    The same problem exists in UI/InputField, UI/Dropdown, UI/Scrollbar and UI/ScrollView

    Hope Unity will fix this issue in the next update...
     
    Last edited: Sep 19, 2019
    Muckel and jeffweber like this.
  4. MechDT

    MechDT

    Joined:
    Jun 18, 2014
    Posts:
    3
    I am seeing the exact same thing for Dropdown's OnValueChanged and InputField's OnValueChange..
     
    jeffweber likes this.
  5. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    I ended up hooking the events up in code using AddListener. Hopefully bug is fixed soon.
     
  6. Ozone_ABN

    Ozone_ABN

    Joined:
    Jan 11, 2014
    Posts:
    12
    I have gone back to version 2019.2.4f1. This error exists btw. also in version 2020.1.0a3 Seems to be some basic problem
     
  7. Muckel

    Muckel

    Joined:
    Mar 26, 2009
    Posts:
    471
    Unity3D has lot's of basic problems now!!!
    it's long ago that we had better tested tool that got released!
    build 2019 are all buggy as hell and should be marked as BETA and not final!
    to me Unity lost focus on the things that matters...
    they let now the Users do beta testing... it's way cheaper ;-)
    but if you spend time and fill all those bug reports...
    nobody gets back to you... no thx nothing...
    Unity is looking for high end ... and is focussing on the 5% user who need a high end game engine...
    they don't really care about us ... Mac Users are not welcome anymore...
    Windows is more important @ Unity now... things have changed and we need to move on...
    best times with Unity where as it was Mac only...
    now the Editor is a big mess... huge slow and full of bug's...

    This slider bug is a best example... Unity does no real beta test anymore... that's why this bug pops up and got not fixed until now...

    Where is the Unity Stuff that cares about this?

    Unity3d is too big now... they don't care about us anymore... no need too...

    M.
     
    protopop likes this.
  8. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    It seems this is fixed now in 2019.3.4
     
    Ozone_ABN likes this.
  9. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,560
    My sliders don't have any Dynamic Float options anymore. - where the value of the target changes to match the current slider value automatically. Im also on MacOS with Unity 2019.2.6. Do you think this is the same thing you are talking about? Is it related?
     
  10. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Sounds like the same issue... Fixed in current beta but possibly introduced in current release?
     
    protopop likes this.
  11. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,560
    Thanks:) Im so afraid of upgrading because so many things break. I just upgraded from 5.6 to 2019 and am starting everything fresh, and am looking for something stable I can build on.

    Unity please fix this in 2019.2.7 if there is one:)
     
    Ozone_ABN likes this.
  12. jason_unity266

    jason_unity266

    Joined:
    Apr 4, 2019
    Posts:
    3
    This is also an issue on ScrollRect.onValueChanged
     
  13. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    A fix is being backported, Sorry for the delays we are working through our processes as fast as possible.
     
  14. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,689
    Tested in 2019.3.0b11, seems most (if not all) UI event hooks no longer send any data with UnityEvent. Worse still, NO EVENT fires at all as far as I can tell.

    Any further update @phil-Unity
     
    ImpossibleRobert likes this.
  15. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Fix has landed in trunk (currently what will be 2020.1) but as thats no use its in the process still of being backported. I dont have much in the way of time frame but it should land before f1 (i'll poke around to make sure it does).
     
  16. ryanmillerca

    ryanmillerca

    Joined:
    Aug 12, 2012
    Posts:
    143
    Any update on this? I have sliders that aren't firing OnValueChanged(single) events despite being connected properly in the inspector with dynamic floats. Using Unity 2019.3.6.

    [update]
    Manually adding a listener, eg:
    Code (CSharp):
    1. slider.onValueChanged.AddListener(OnValueChange);
    makes this work okay, but the inspector method is more common and should be fixed!
     
    Last edited: Mar 30, 2020
  17. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    The fix should have landed by now, are you on the latest version? Could you file a bug otherwise?
     
  18. Moonguard

    Moonguard

    Joined:
    Dec 5, 2015
    Posts:
    1
    I have a unity version 2019.3.7f1. The problem persists.
     
  19. Boudewijn

    Boudewijn

    Joined:
    Mar 23, 2016
    Posts:
    15
    'onValueChanged' can not be found in the scripting API since 2019.2. Is there a new way to use the value of a slider in a script?
     
  20. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Follow up question do you have the domain reload option on or off?
     
  21. ryanmillerca

    ryanmillerca

    Joined:
    Aug 12, 2012
    Posts:
    143
    Sorry for the late reply, I have domain reload on.
     
  22. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    So that shouldn't be the issue then, Just to confirm are you still having the issue or just following up with the answer?
     
  23. Gladiator-Apps

    Gladiator-Apps

    Joined:
    Jan 3, 2018
    Posts:
    3
    Still occurring. upload_2021-9-6_14-24-25.png
    Can't see the parameter of function in the inspector.
     
  24. ObelardO

    ObelardO

    Joined:
    Feb 20, 2015
    Posts:
    3
    For custom scripts use:
    Code (CSharp):
    1.  
    2. [Serializable]
    3. public class UnityEventFloat : UnityEvent<float> { }
    4. public UnityEventFloat _onVolumeChanded = new UnityEventFloat();
    its worked for me at 2019.2.x

    and this doesn't work:
    Code (CSharp):
    1.  
    2. [Serializable]
    3. public class UnityEventFloat : UnityEvent<float> { }
    4. [SerializeField]
    5. private UnityEventFloat _onVolumeChanded = new UnityEventFloat();