How to make object point to cursor

I am making a 2D game where the player and eyes and separated. I want the eyes to point to the mouse cursor, but the player base doesn’t rotate. Here is what I am trying to achieve:
2023-07-02 18-55-45

Nevermind, I figured it out, and for anyone who needs it, here is the code:

public Camera mainCamera;

void FixedUpdate()
    {
        var dir = Input.mousePosition - mainCamera.WorldToScreenPoint(transform.position);
        var angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
        transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
    }