Hit Angle Of Ray to Surface?

Ive been looking around but i have a weakness with angles in 3d space. How would i calculate the angle of a raycasthit to the surface it. I assume its utilizing the information from “hit” in the raycast, perhaps the normal data, but i dont quite know how to get it.

What you want is the dot product between the normal and your ray direction.

The dot product between two directions equals the cosine of the angle :

All you need to do is to take the direction of the ray and make a dot product with the normal from the raycast hit.

   Ray r;
   RaycastHit hit;
   ...
   float cosine = Vector3.Dot(r.direction,hit.normal);
   float cosineDegrees = Mathf.Acos(cosine);