How do I run javascript code when a toggle is clicked? what function do I have to include in my script?
if(toggle.isOn == true){
// your script
}
I figured it out.
- The script has to be added to the Main Camera view.
- There must be a Canvas added to the Main Camera.
- The script variables are set up in the Start function, and triggered in the onGUI function.