Unity3D Slider onValueChanged sending only 0 (or other defined value)

Filip Vondrášek picture Filip Vondrášek · Sep 20, 2015 · Viewed 25.3k times · Source

I'm trying to attach an onValueChanged event to my GUI Slider, but for some reason it gives me a mandatory option to put a value in (it's the fourth box in the "On Value Change (Single)" section). Then it only sends the forementioned value, not the actual value of the slider.

enter image description here

The code for the event is as follows:

public void ChangeWindDirection(float value)
{
    Debug.Log("New wind direction: " + value);
}

I tried restarting both Unity and Visual Studio 2013 to no avail. Now it even puts the box with a value to every new event I try to create.

Answer

dev_ter picture dev_ter · Mar 30, 2016

this is the best answer i found:

(posted as a comment by Jesper)

Make sure you selected Dynamic float from the OnValueChanged drop down list in the inspector

click here for the image