Dissapearing Blocks

Hey, remember those disappearing blocks from the old Megaman games? (The ones that would appear in a set pattern, and if you fell off or jumped the wrong way, they would mean certain doom :roll: )

I’m trying to create some blocks similar to those, in which each individual block would loop through a set array of waypoints, but neither my teacher nor I am sure how to use While or For loops in Unity. The way I’d like to set it up is that when the player triggers them, they will start going through their list of waypoints, one by one, wait a few seconds at each point(not necessarily 5), and then repeat the list until the disappearing block system is deactivated. Any help would be greatly appreciated.

var waypoints : Transform[];
var active : Boolean;


While (var active = True)
{
	for (var currentpoint in waypoints)
	{
		transform.position = currentpoint.position;
		//Place the block at the nth waypoint
		yield new WaitForSeconds (5);
		//Wait 5 seconds so the player can get on
	}
}

such a pattern appear - disappear system sounds like a good job for a coroutine with an inner loop that loops over all blocks and has a fixed waitforseconds wait time and an infinite outer loop with an own waitforseconds wait time between the “pattern runs”