Multiple Bullet Hit Effect

Hi guys
I need of your help again.
I have a bullet Prefab with a bullet script. Now what i’m working on is this:
If the bullet hit something with the PhysicMaterial Metal then it should Instantiate a MetalHitEffect, if the bullet hit something with the PhysicMaterial Wood then it should Instantiate a WoodHitEffect and if the bullet hit something with the PhysicMaterial Terrain then it should Instantiate a TerrainHitEffect.
Now i know that this can be made in the OnCollisionEnter function, but i don’t know how can i get the PhysicMaterial of the collision :S.
If you know the solution or can anyone help me understand this it will be valued.
Thanks, bye.

You can access the physic material like that : collider.material. However, you can’t really tell which is wood and which is metal, nuless you test if friction is < or > to some threshold. And if you ever want to add a third material, or change that threshold, things get complicated.

You should use a tag, or a layer, or a custom class that contains an enum Wood, Metal etc if you need tags/layer for something else.