Toggle Event passing bool [4.6+]

So by reading the documentation for a toggle it says this “The Toggle has a single event called On Value Changed that responds when the user changes the current value. The new value is passed to the event function as a boolean parameter.”

What this means to me is that I should be able to assign a function that receives a boolean parameter and it will pass it but this does not occur.

Simple function I would assign is like this

public void ToggleChanged(bool Value)
{
Debug.Log(Value);
}

When assigned to the event I am only able to assign the value, so its either always going to be false or true, its not going to be the value which it has changed to.

So my question is what is the proper syntax for the function, I can’t find any documentation on this.

Make sure you select the method located under the “Dynamic bool” header.

All what you get from toggle is the event. Passing bool manually will result in constant value as it’s a hard-coded parameter. Of course you can set it by code, but in this case it’s unneeded.

Instead, cache the toggle component;

using UnityEngine.UI; //include UI namespace before class declaration

public Toggle toggle; //drag from inspector

And set the event for value changed without parameters.

public void eventValueChanged(){
    Debug.Log("Toggle is "+toggle.inOn); //check isOn state
}

I hope i made this understandable.