disable rigidbody unity script code example
Example 1: disable rigidbody unity
//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
Example 2: unity rigidbody2d disable
//you can't :(
//you can delete it with
Destroy(RigidBody2D);