flip a sprite with horizontal input c# code example
Example: unity c# flip sprite
public Camera cam;
public Transform aimTransform;
Vector3 mousePosition = cam.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y));
Vector3 aimDirection = (mousePosition - transform.position).normalized;
float angle = Mathf.Atan2(aimDirection.y, aimDirection.x) * Mathf.Rad2Deg;
aimTransform.eulerAngles = new Vector3(0, 0, angle);