Checking material on raycast

Hi,
I am making a a decal system for a game. Basically I need to place different decals on different materials, so if the player shoots a brick wall I need to place a brick wall bullet hole decal. It seems that a lot of people just tag everything in their scenes and check for those tags when ray tracing, but what if you have objects made of multiple materials, then tags won’t work.

Is it possible to get the material that a ray cast hits? If so, how? Is there an alternative low maintenance approach?

I also need to do something similar for stepping sounds on different materials, and I would like to avoid tags and triggers.

Here is a solution to your specific problem:

http://forum.unity3d.com/threads/53123-Get-Material-From-Raycast

And here is an answer that explains a bit more about sub meshes and walks the triangles arrays:

http://answers.unity3d.com/questions/291853/raycasthit-triangleindex-and-submeshes-which-subme.html