I’m trying to limit movement to inside a certain area.
In 3d Unity I could do this (from the Project: Space Shooter):
rigidbody.position = new Vector3 ( Mathf.Clamp (rigidbody.position.x, boundary.xMin, boundary.xMax), 0.0f, Mathf.Clamp (rigidbody.position.z, boundary.zMin, boundary.zMax) );
However, rigidbody2D doesn’t have a .position. I tried using transform but I am clearly confused on some part of it as I was getting an error from it.