I’m trying to create a toggle that will switch on while the button is held down, and once the button is released, it will toggle off.
Any Idea how to do this?
Here is what I have thus far.
What Input type would I use for a button being held down. Also I only want the toggle to execute once.
For testing the input of a mouse button, you want to use Input.GetButtonDown() and Input.GetButtonUp() to see if a specific button is being pressed.
You can use these to determine when the button is pressed, and consequently, released.
If you want to test a specific key on the keyboard, you want to use Input.GetKeyDown() and Input.GetKeyUp(), respectively.
More on those functions here: http://unity3d.com/support/documentation/ScriptReference/Input.html