- Home /
unity2d cannot create if gravity level
Hi everyone I am working on a new game where one of the main features is gravity flipping but I cant find a way to call an if statement that checks the gravity level for example.
if(Physics2D.gravity.y == -9.8f){
dosomething();
}
thank you in advance
thanks just figured it out just had to Physics2D.gravity.y != 0 so it was for some reason not the value I had set it.
if you wanted to post that as an answer I can select it
Answer by Lo0NuhtiK · Mar 30, 2014 at 10:56 PM
Looks like you've got it to me. Make sure your physics2d gravity is actually set at that value if you want it to do anything.
Your answer
![](https://koobas.hobune.stream/wayback/20220613141551im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
unity2d change angular direction 1 Answer
How would I change a value in a 2D Rigidbody 1 Answer
Error when colliding and calling a IEnumerator 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers