Audio Fading Question

This is probaby-very-simple-question-which-im-too-noob-to-figure-out. How can i make my audio fade out when i turn away. I have it like when i look at object it rises. And when i look away it fades away. I currently have this and it’s not working:

 if (canSee == false && audio.isPlaying){
			audio.volume -= 0.01f;
  1. Be sure your AudioClip is not set as 3D audio in the import
    settings, otherwise the volume will
    fade out as the object with your
    AudioListener attached (by default
    MainCamera) goes away from the
    object with the AudioSource.
  2. The audio.volume can only be used
    if the script is attached to the
    object with an AudioSource
    component, so be sure of that too.

Note: If your AudioSource and your AudioListener are attached on different objects you need to make a reference to the AudioSource at the script in the AudioListener using a public variable or find the other object at Awake() and then modify volume every frame.

Something like this:

GameObject objectWithAudioSource;
void Awake(){
   objectWithAudioSource = GameObject.Find("NameOfObjectWithAudioSource");
}

void Update(){
   if (canSee == false && objectWithAudioSource.audio.isPlaying){
      objectWithAudioSource.audio.volume -= 0.01f;
   }
}