Well, first off, transform.rotation.y
isn't in euler angles (ie 0-360 degrees), it uses quaternions. You were correct the first time, when using transform.eulerAngles
, but there are one or two things you should check first.
For starters stick the line: Debug.Log(transform.eulerAngles.y)
above your if clauses. You may find that you're not actually rotating on the Y axis (unity is weird about this sort of thing, so that's quite often the case). Or you may find that you're rotating at negative degrees (although in my experience this doesn't occur, even though giving an object a negative angle will work just fine).
You could also try rotation.localEulerAngles.y
instead, which may work better depending on the parenting and rotation of your camera object.