Is it possible to pick up "mouse up" on value changed ?

I generate slider and I assign function using Delegate to control slider and other UI elements/data.

I don’t feel like making another function for mouse up though, because my function already does some a bit more complex logic, new function would just be a mess.

Can I somehow find out did the user stop sliding slider (released mouse button) from inside of OnValueChanged ?

FooSlider.onValueChanged.AddListener(delegate { sliderMgr(someinteger, someObject2, sliderval); });

void sliderMgr(int one, myEnum, float val)
{
  // Can I find out if user released mouse or slider here?
}

I generate a lot of sliders by the way, and all are controlled by one function.

Once user leaves the slider I would need to store value, an index for an array, then type of that slider and so on.

If there is a way to figure out if user released slider in that function above, onValueChanged, it would be amazing!

P.S. I’m using UGUI.

Thanks.

OnValueChanged is unlikely to be triggered when the slider is released. You can check this by running a small test in the editor… Input.GetMouseButtonUp() is not set when OnValueChanged occurs, and in fact for me seems to always occur at least 2 frames later.

Can you explain more exactly what you are trying to do? If I know your intent it’s easier to help.

If you just want to re-use your logic except know if the slider has been released, then just re-use your function:

  • Add EventTrigger to the slider, add an PointerUp callback to for when the slider is released.
  • Add a parameter ( bool mouseUp) to the callback function. Set it always false for OnValueChanged, always true for PointerUp.

That way you call the same code but also pickup the end of sliding event.