Reputation: 173
I want to start a toggle button using the new Unity interface but I want it to start as Off or unchecked.
I created the button:´
public Toggle toggleBool1;
and dragged the toggle button created in the scene into this toggleBool1 slot in the inspector it works fine, but I can't make it to start as off.
Do you know how to achieve this?
Upvotes: 1
Views: 2172
Reputation: 3040
Simply use the Toggle.isOn
property to check/uncheck the toggle in code. For example, you can set isOn
to false
in the Start()
method of the script you have dragged the Toggle
onto to make the Toggle
start off unchecked.
public Toggle toggleBool1;
void Start ()
{
toggleBool1.isOn = false;
}
Upvotes: 3