//This is for Unity (c#)
Rigidbody rb; //For 2D games use 'Rigidbody2D'
void Awake ()
{
rb = GetComponent<Rigidbody>();
}
// (...)
rb.bodyType = RigidbodyType2D.Static; // Deactivated
rb.bodyType = RigidbodyType2D./*The type the rigidbody was originally eg. dynamic, kinematic, or static*/; // Activated