get x of eulerAngles code example
Example: x angle oes back after 90 unity
public static float CalcEulerSafeX(float x)
{
if (x >= -90 && x <= 90)
return x;
x = x % 180;
if (x > 0)
x -= 180;
else
x += 180;
return x;
}