unity rigidbody constraints unfreeze code example

Example 1: rigidbody2d unfreeze position

public Rigidbody2D rb;

void Start()
{
	rb.constraints = RigidbodyConstraints2D.None;
}

Example 2: unity rigidbody constraints

m_Rigidbody = GetComponent<Rigidbody>();
        //This locks the RigidBody so that it does not move or rotate in the Z axis.
        m_Rigidbody.constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotationZ;

Example 3: unity rigidbody constraints unfreeze

rb.constraints = RigidbodyConstraints.FreezePositionX | ~RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ;