How to get an object to fade in and out.

Recently been working on a Diablo 3 like game and want all objects above the player to fade out so the player can see where he is going on the ground below him. Currently my code to make the objects that are tagged to fade out looks like this:

foreach (GameObject item in allGOs)
                foreach(Material a in item.GetComponent<Renderer>().materials)
                    a.SetFloat("_Mode", 2);
                    a.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
                    a.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
                    a.SetInt("_ZWrite", 0);
                    a.renderQueue = 3000;

                    Color originalColor = new Color(a.GetColor("_Color").r, a.GetColor("_Color").g, a.GetColor("_Color").b, 1.0f);
                    //while (originalColor.a > 0.0f)
                    //    originalColor.a -= 0.01f * Time.deltaTime;
                    originalColor.a -= 0.5f * Time.deltaTime;
                    if(originalColor.a <= 0.0f)
                        item.GetComponent<MeshRenderer>().enabled = false;
                    a.SetColor("_Color", new Color(originalColor.r, originalColor.g, originalColor.b, originalColor.a));

                    //a.SetColor("_Color", new Color(originalColor.r, originalColor.g, originalColor.b, 0.0f));
                //item.GetComponent<Renderer>().material.SetFloat("_Mode", 2);

                //item.GetComponent<MeshRenderer>().enabled = false;
                item.GetComponent<MeshCollider>().enabled = false;

This code loops through all objects that are tagged and sets there rendering style to fade and then im doing the alpha fading from there and applying the new color but there has got to be an easier way to do this. The code doesn’t fully work and the Object does not fade the way I would like it too, is there any better way to do this?

Found the answer here: Make object transparent when between camera and player - Questions & Answers - Unity Discussions