I looked at the Toggle API and can't find a way to set it to checked with code. http://docs.unity3d.com/ScriptReference/UI.Toggle.html
The reason I want to do it is that I want to set a checkbox as checked depending on a setting when the game starts.
Any ideas on how to do this?
Thanks!
http://docs.unity3d.com/ScriptReference/UI.Toggle-isOn.html
Use the public variable Toggle.isOn
. Set it to true like this: myToggle.isOn = true;
.
You probably looked for a method, but don't forget to also look at the public variables, as these are part of the API as well.
Toggle.isOn wont do anything, sorry. do this:
toggle.onValueChange.Invoke(true) //or false if you want to uncheck it