Get transform rotation seen in inspector

I am jerry rigging a system for my enemy to pathfind in a top down twin stick shooter. I just need to know why this code is not returning the value of the rotation seen in the inspector. RotateRay is a Transform with a child gameobject attached to it.

        RaycastHit2D rotatingRayHit = Physics2D.Raycast(RotateRay.transform.position, Vector2.right, 5, layerMaskWalls);
        Debug.DrawRay(RotateRay.transform.position, RotateRay.transform.right * 5, Color.green);
        RotateRay.Rotate(new Vector3(0, 0 , 1) * 100 * Time.deltaTime);

        Debug.Log(RotateRay.transform.rotation.z);

Don’t rely on transform rotations this way. Think of them as “write only.”

Here’s more:

https://starmanta.gitbooks.io/unitytipsredux/content/second-question.html