- Home /
Question by
danielbertrand · Dec 19, 2014 at 11:20 PM ·
javascripttoggle
How do I run javascript code when a toggle is clicked?
How do I run javascript code when a toggle is clicked? what function do I have to include in my script?
Comment
get the object that has the javascript and by using GetComponent() function you can enable or disable that script
Answer by danielbertrand · Dec 20, 2014 at 07:12 PM
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.
Your answer
Follow this Question
Related Questions
Toggle button help 1 Answer
GUI.Button toggling object visibility. 1 Answer
Trouble getting GUI phone to open/close 1 Answer
Render toggle help.. 1 Answer
help with Flashlight Pickup 1 Answer