rigidbody2d unity

Code Example - rigidbody2d unity

                
                        Rigidbody2D rb; 

// Can use Awake
void Start()
{
	// Ataches the rigedbody that is on the gameObject to rb
	rb = GetComponent<Rigidbody2D>();
}
                    
                
 

unity rigid body variable

                        
                                public Rigidbody rigidbody;
                            
                        
 

how to add reference to rigidbody 2d

                        
                                public Rigidbody2D rb;