Making stepsSounds by using OnCollisionEnter or raycasts ? Optimizations question

I think your code seems perfectly reasonable.

For future reference, when posting code on the forums, please look at this thread for code tags: Using code tags properly