- Home /
First Person Controller gravity changing script.
Hi, for my game, I have created a Zero Gravity GUI Button and I need help on making a script for it so that when I click it, it will change the gravity to 2 and when you click it again, it will change back to 20. Thanks, Dean_0707
Answer by Beriss · Jun 10, 2012 at 10:47 AM
Why don't you make animation instead of changes gravity?
Answer by mkleinrock · Jun 10, 2012 at 07:15 PM
You could create an if statement in the onClick script. Set up a boolean variable for gravity. Then check to see if gravity is on or off. Then set the rest of the function up accordingly.
Your answer
![](https://koobas.hobune.stream/wayback/20220613072600im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Does First Person Controller have infinite mass? 1 Answer
First Person Controller vs. Character (Penelope Tutorial) 2 Answers
Platforming - moving up sloped surfaces ? 0 Answers
Not Run while Aiming; Slope Terrain Making Object Faster 0 Answers