Well because your cursor does not have a position in the 3d world i will assume you are working in 2d… this is the way i do it.
tempx holds the difference between the object and what i want it to look at (currenttarget) on the x axis
tempy holds the difference “”“”" on the y axis
Mathf.Atan(tempy/tempx)
is a simple trig function to give me the angle to it
Mathf.Rad2Deg*
Is because unity does that in radians so i have to change it to degrees for the rotation
Quaternion.AngleAxis(newz,Vector3.forward)
vector3.forward is setting the axis i want it to rotate on (z axis for 2d games)
you should be able to adapt this code easily for your purposes using