Detecting a certain degree angle?

Hey, trying to figure out how to detect if a rotation is greater than 180 degrees or less than, so I can change states.

I’m coding in C# and can’t really find out how to say in code

if transform.rotation = <180

or something like that, no idea how to do it. Any help would be appreciated.

Rotation are done around an axis, so you need to access the good component. However, transform.rotation is a quaternion, which is a little complicated. But you can use the property eulerAngles. So, to test the rotation around the y axis :

if( transform.rotation.eulerAngles.y = <180 ) ...

What are you using it for exactly? Do you want to know if something rotated 180 degrees in any combination of directions? About a single axis? Is the rotation relative to another object, like trying to detect if something is facing opposite to something else?