Search Unity

Referencing the Toggle that was clicked in "On Value Changed" without static variable

Discussion in 'Scripting' started by Larpushka, Aug 30, 2015.

  1. Larpushka

    Larpushka

    Joined:
    Jan 6, 2015
    Posts:
    214
    So I added a void function to be executed on "OnValueChanged". How do I reference the specific Toggle that was clicked in the void function?

    Something like

    Public Toggle MyToggle;
    MyToggle = ??? ;
    if (MyToggle.isOn == false)....


    How do I reference MyToggle for the specific Toggle that had its value changed?