I followed an answer on the Unity Forums on how to rotate an object according to the position of the mouse. The code works for changing the rotation, but it uses some other para
First things, you seem to imply that there you have this code on two different objects. You should create a single script called "LookAtMouse". Whatever you put this on if what will look at the mouse.
public Camera cam;
void Update() {
Vector3 direction = Input.mousePosition - cam.WorldToScreenPoint(transform.position);
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
}
So this should be only on the player.