unity gravity

Code Example - unity gravity

                
                        //Use the component RigidBody
                    
                
 

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);
                            
                        
 

Related code examples