Rigidbody2d Freeze Position
public Rigidbody2D rb;
void Start()
{
rb.constraints = RigidbodyConstraints2D.FreezeAll;
}
Comfortable Capybara
public Rigidbody2D rb;
void Start()
{
rb.constraints = RigidbodyConstraints2D.FreezeAll;
}
rb.constraints = RigidbodyConstraints2D.FreezePositionX;
rb.constraints = RigidbodyConstraints2D.FreezePositionY;