UI Toggle OnValueChanged sometimes forces me to select an input.

Hi all,

I have two UI Toggles, set up in pretty much the same way. I added an On Value Changed event to one through the UI and it now looks like this;

This works as expected; when I click the toggle my script receives “true” if the toggle is checked and “false” otherwise. I then added a similar event to the other and it now looks like this;

Notice that check box I’ve circled in red has appeared and it seems to be asking me to define what input my script should receive. When I run my app like this my script always receives a value of “false” regardless of whether the toggle is pressed. If I check that check box then it always receives a value of “true”.

Any idea how I can get this second toggle to act like the first and actually pass the correct value through to my script?

For reference my script looks like this;

        public void SetBold(bool enabled)
        {
            m_bold = enabled;
            SetPreviewText(m_previewText);
        }

        public void SetItalic(bool enabled)
        {
            m_italic = enabled;
            SetPreviewText(m_previewText);
        }

In ‘On Value Changed (Boolean)’ change the function you want to call from ‘SetBold(bool)’ (under ‘Static Parameters’) to ‘SetBold’ (under ‘Dynamic bool’) and it should work like your other toggle button.