Quantcast
Channel: Answers by "ShinyMark.du"
Viewing all articles
Browse latest Browse all 11

Answer by ShinyMark.du

$
0
0
I'm not going to write the code for you but to write a simple toggle do the following: 1. Create a boolean variable to store the on/off state 2. Change your if-statement with Input.GetButton to instead call Input.GetButtonDown, which becomes true only once on the frame the button was pressed 3. Flip the boolean variable from true/false inside the if block 4. Depending on the state of that variable setup your parameters as before

Viewing all articles
Browse latest Browse all 11

Trending Articles