character current angle

hello!
I want to store in to a variable the current angle of my player, I want to know if the player is rotating 90 degrees or every change in its angle.

I was trying this code :

float angle = transform.localRotation.z;

but it is not working, what do you suggest? thank you

I would suggest two things,
One, look at localEulerAngles over localRotation
Two, look at Angle()

Thank you very much!!! you are right.
this is the code:
float currentAngle = transform.localEulerAngles.z;

just in case someone have the same problem.