2D Game: How do I get player to rotate in direction of arrow keys pressed?

Hello. I am trying to code (without using the New Input Package) 2D player rotation for my game. However, I’m stuck on how to do it. I want it so that up arrow always faces up, but up + right always faces the top right diagonal. This is what I have so far:


//This is not working for me. These two inputs are left/right arrow
//and up/down arrow respectively. The character defaults facing to the right
float rotH = Input.GetAxis("P1_Rotate_Horizontal") * -180;
float rotV = Input.GetAxis("P1_Rotate_Vertical") * 90;

//Get current and desired rotation
Quaternion currentRot = transform.rotation;
Quaternion targetRot = Quaternion.Euler(0, 0, rotH + rotV);

//Get new rotation and assign it
Quaternion newRotation = 
    Quaternion.RotateTowards(currentRot, targetRot, rotateSpeed * Time.deltaTime);
transform.rotation = newRotation;

Try this:

// Note: no multiplication here
float horizontal = Input.GetAxis("P1_Rotate_Horizontal");
float vertical = Input.GetAxis("P1_Rotate_Vertical");

var lookDirection = new Vector2(horizontal, vertical);
 
Quaternion targetRot = Quaternion.FromToRotation(Vector2.up, lookDirection);