dr3th
March 16, 2015, 1:38pm
1
I would like to set the IsOn Property to True. The API states that one can only get the “IsOn” values of when it was instatiated. There is no setter for the property it seems.
GameObject togGameObj= GameObject.Find("MyToggle");
Toggle myTog = togGameObj.GetComponent<Toggle>();
myTog.IsOn = true;
B3aT
March 16, 2015, 2:50pm
2
I do not think you can control the UI elements directly, you must use the EventSystem class.
So trigger it old fashion web way, simulate a click.
ExecuteEvents.Execute<IPointerClickHandler>(gameObject, new PointerEventData(EventSystem.current), ExecuteEvents.pointerClickHandler);
http://docs.unity3d.com/Manual/SupportedEvents.html
http://docs.unity3d.com/Manual/MessagingSystem.html