Basically you add this to any gameobject that you want to act under the control of physics.It is added as a component in the inspector window in Unity.

In your class file for the gameobject you can make it a required component so that you don’t need to check that it’s there. You do this with the code

 [RequireComponent(typeof(Rigidbody))]