MRTK 2 Toggle State

Hi, I am trying to get the state of a toggle button that has been clicked but I don’t see a way to do that.

Also, I would like to set the initial state of the toggle to on.

Thank you!

Update: I realized one way I can do both of the above is by accessing the Interactable script and getting or setting the value of the Dimension.

Hi,

Indeed you have to access interactable, IsToggled is available in MRTK 2.4.0

gameObject.GetComponent<Interactable>().IsToggled
2 Likes