title: Make objects between camera and character transparent
body: <p>I'm working on a script for my camera to make objects between itself and the character transparent.</p>
  
  <p>I managed to make it work with RayCast however I don't know how to restablish objects alpha value after they escape the ray.</p>
  
  <p>This is my current code:</p>
  
  <pre><code>private void XRay() {
      float characterDistance = Vector3.Distance(transform.position, GameObject.Find("Character").transform.position);
      Vector3 fwd = transform.TransformDirection(Vector3.forward);
  
      RaycastHit hit;
      if (Physics.Raycast(transform.position, fwd, out hit, characterDistance)) {
  
          // Add transparence
          Color color = hit.transform.gameObject.renderer.material.color;
          color.a = 0.5f;
          hit.transform.gameObject.renderer.material.SetColor("_Color", color);
      }
  }
  </code></pre>