how to change gravity unity

Code Example - how to change gravity unity

                
                        // Four times as strong
Physics2D.gravity = new Vector2(0, Physics2D.gravity.y * 4); 

// Half the strength
Physics2D.gravity = new Vector2(0, Physics2D.gravity.y / 2);
                    
                
 

unity gravity

                        
                                //Use the component RigidBody
                            
                        
 

Related code examples