Fade camera while teleporting

Hello all.

I’m working on some code that will fade the camera to black after hitting a button. While the camera is faded to black, I’m going to teleport it throughout my scene. I have this code that I found on another question about creating a fade for the camera:

alphaFadeValue = Mathf.Clamp01(alphaFadeValue - (Time.deltaTime / 5));

GUI.color = new Color(0, 0, 0, alphaFadeValue);
GUI.DrawTexture( new Rect(0, 0, Screen.width, Screen.height ), blackTexture );

but as of right now it is doing nothing. Its not directly in OnGUI, but it is in a function that is being called from OnGUI. Is there something wrong with the above code, or is there something wrong with my logic? Any help would be greatly appreciated.

Put the gui stuff in OnGUI , throw the alphaFade into another function and call it from update (or put it in update itself)

e.g.

bool fade = false ;
void Update(){
   if(get a key down)
    fade = true ;

   if(fade)
      FadeStuff() ;
}
void FadeStuff(){
   alphaFade = mathfJunk ;
}
void OnGUI(){
   GUI.color = whatever ;
   GUI.DrawTextures = whateverElse ;
}