We can simply hide and show a game object using Unity UI toggle as shown in the link below.
• Show and Hide Object with UI Toggle i...
However, sometimes, we need to pass the toggle value as a boolean variable in C#, or to change a text, for example, based on the toggle value.
The Toggle has a single event called On Value Changed, which passes a boolean parameter to the event function in C#.
Make sure to choose Dynamic bool when selecting a method On Value Changed (Boolean).
Code on GitHub:
https://github.com/DA-LAB-Tutorials/Y...