how to switch textures

how do i switch textures like if i am mining a rock it cracks.

For simple diffuse textures and the like, you can usually adjust renderer.material.mainTexture to whichever texture2D you'd like shown. If you're using a more complex shader, you'll want to look into SetTexture