Make UI Image rotate In the direction of axis?

Hi
I have a UI Image in my scene that looks like an arrow. Here’s that…


I need some kind of script or tutorial so hat it will rotate in the direction of the move axis. For example, if the input is…

(Input.GetAxis("Horizontal") < 0

then the UI Image will rotate to 90 on the Z axis. Or if the input is…

(Input.GetAxis("Horizontal") > 0

then it will rotate to -90 on the Z axis. I just want it to face the direction you hold the movement axis. Does anyone have a script I could use, or a video tutorial I could watch?

if (Input.GetAxis("Horizontal") < 0){
yourUIObject.transform.rotation = Quaternion.Euler (0, 0, 90);
}