i'm trying to unfreze my Rigidbody2D constraints but it comes up with an error

error: An object reference for the non-static field, method, or property Rigidbody2D.constraints

If you need more of the script to help me then please ask, it’s quite long and I don’t want to send a huge message if I don’t have to

void Patrol()
    if (mustTurn || bodyCollider.IsTouchingLayers(Default))
    rb.velocity = new Vector2(walkSpeed * Time.fixedDeltaTime, rb.velocity.y);
    Rigidbody2D.constraints = RigidbodyConstraints.None;

This error is thrown because constraints is member (instance) property and you are using it like it is a static one.


rb.constraints = RigidbodyConstraints2D.None;

Thanks so much!! worked perfectly.