Link UI Toggle to a Boolean Variable in C# Unity

Published: 15 January 2023
on channel: DA LAB
2,700
24

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...


On this page of the site you can watch the video online Link UI Toggle to a Boolean Variable in C# Unity with a duration of hours minute second in good quality, which was uploaded by the user DA LAB 15 January 2023, share the link with friends and acquaintances, this video has already been watched 2,700 times on youtube and it was liked by 24 viewers. Enjoy your viewing!