WaitForSeconds while looping through multiple game objects

I have 20 mesh objects and I want to slowly (every 1 second or so) make each one inactive when the user inputs the R-KEY. My first thought was the code below, but it isn’t working and I’m guessing it is because the function is in the Update() function. Anyone have any suggestions?

In case it helps to look at the project, I am working on the visualization in the below link and want to make the spiral disappear slowly and reappear in a similar way.

using UnityEngine;
using System.Collections;

public class MeshlAnimation : MonoBehaviour {
	
	int n = 20; // number of mesh objects
	
	void Update () 
	{	
		if ( Input.GetKey(KeyCode.R) )
		{
			ToggleActiveGameObjects();
		}
	}
	
	void ToggleActiveGameObjects( )
	{
		foreach ( Transform meshObj in GetComponentsInChildren<Transform>() ) 
		{
			StartCoroutine(InputDelay(meshObj));
		}
	}
	
	IEnumerator InputDelay( Transform meshObj )
	{
    	meshObj.gameObject.active = false;
		yield return new WaitForSeconds(.5f);
	}
}

Thanks.

Psudocode:

float timeAccumilator = 0f;
float triggerAtTime = 1f;
int nextToUpdate = 0;
List listOfThingsToUpdate

on Update:
  timeAccumilator += Time.deltaTime;
  if timeAccumilator > triggerAtTime 
  then
    DoSlowFunctionTo(listOfThingsToUpdate[nextToUpdate] )
    nextToUpdate++;
  end
end

Let me know if that makes sense.

You could alter your coroutine method to take a float as well as the Transform and WaitForSeconds for that float before setting active to false:

	void ToggleActiveGameObjects( )
	{
		float delay = 0f;

		foreach ( Transform meshObj in GetComponentsInChildren<Transform>() ) 
		{
			StartCoroutine(InputDelay(meshObj, delay));
			delay += 0.5f;
		}
	}
	
	IEnumerator InputDelay( Transform meshObj, float delay )
	{
		yield return new WaitForSeconds(delay);
		meshObj.gameObject.SetActiveRecursively (!meshObj.gameObject.active); //toggles active
	}

Exactly what I needed. Thanks for the help.