Help rotating an Object

I am trying to rotate a character, in a 2d world, to the left or right depending on which half of the screen the mouse cursor is on. My code is: if (Input.mousePosition.x >= Screen.width / 2) { zombie.transform.rotation = new Quaternion(0f, 270f, 0f, 0f); } else { zombie.transform.rotation = new Quaternion(0f, 90f, 0f, 0f); }

When it runs the character just rotates towards the back wall and stays there regardless of where the mouse is. I get the feeling there is an easy answer to this but I just can't find it. Thank you in advance!

No no no no no no nooooooo. Never directly set a quaternion's values.

You want zombie.transform.rotation = Quaternion.Euler(0, 270, 0); and zombie.transform.rotation = Quaternion.Euler(0, 90, 0);