change texture on proximity c#

Hi to all, i searched on the forum but couldn’t find an answer to restore old texture after i changed it:

foreach( GameObject  foto in fotos)
{

  
   if (Vector3.Distance(foto.transform.position, player.transform.position) < 20)
   {
	Texture2D tex =	(Texture2D) Resources.Load(nomeFoto, typeof(Texture2D));
				
	
				
	
				 foto.renderer.material.mainTexture = tex;
    
   }else{
	            
				 ??restore old texture??
   }
			
}

i tried gettng the old texture with:

Texture2D oldTex = foto.renderer.material.GetTexture("_MainTex") as Texture2D;

and then replace the new with:

foto.renderer.material.mainTexture = oldTex;

but it wont works, any suggestions?