access material that is linked to face


I wanted to ask this to see if it was possible!

Is it possible to get the material that is displayed on a face?

For example, I have a mesh with two materials. If I 'shoot' the mesh, can I see what material was assigned to that face?



If 'shoot' the mesh means colliding with the mesh (detected by OnCollisionEnter or a Physics.Raycast) you can access the component(s) like this:

Graphics material used by the renderer:


The Physics material is also available: