Causing the player to become transparent if camera too close

My students and I are working a 3rd person shooter. With some help from various tutorials we have a decent script for the camera. The only problem is sometimes the camera penetrates the player mesh when the player is backed against a wall and there is not enough room for the camera. I thought we might just make the player mesh transparent when the camera is too close and then turn off transparency when the camera is far enough away not to penetrate the mesh. The player is a prefab.

I have not been able to figure out a script to make that work. I think I am missing something simple

I have a camera controller script and a player controller script. We are using C# to script with. Maybe there is a better or easier way to solve this issue.

If you want semi-transparent, look into GetComponentsInChildren() and set the main color alpha accordingly