Error: The best overload for the method 'UnityEngine.Rigidbody2D.AddTorque(float)' is not compatible with the argument list '(UnityEngine.Vector2)'.

I’ve got this error with my script below. I don’t know what the problem is, because I believe I am passing it the correct arguments.

function RotateShip () {
	//get input
	rotateSpeed = Input.GetAxis("Horizontal") * 40 * Time.deltaTime;
    
	var forward : Vector2;

	forward = transform.forward;

	forward.Normalize();

	forward = forward * rotateSpeed;

    //control rotational force
    if(rotateSpeed > maxRSpeed){
    	rotateSpeed = maxRSpeed;
    }
    if(rotateSpeed < -maxRSpeed){
    	rotateSpeed = -maxRSpeed;
    }

    rigidbody2D.AddTorque(forward);
}

Any help?

As stated in the docs, “Note that unlike a 3D Rigidbody, a Rigidbody2D can only rotate in one axis and so torque is a float value rather than a vector.” The docs also describe the parameters of Rigidbody2D.AddTorque as “AddTorque(torque: float): void”.