How to affect each child Object individually over time?

Hi!

I am building a puzzle.
The puzzle is a series of boards where the player must collect keys and reach the Goal.

I store all cubes inside a GameObject called Maps. I want to show the new challenges, i.e. boards, in an interesting way. I want to show the cubes individually and do something, change their position, change color…do something when the level starts.

How do I access each object inside Maps with a small delay between each object?

Below there is a screenshot of a board and what everything is.

  • The purple cilinder is the player.
  • The blue cube is where the player begins
  • The small green cubes are keys
  • The big green cube is the Goal
  • The player must take all the small green cubes in order to reach the big green cube, the Goal, to go to the next level.
  • The colors of the yellow cubes are irrelevant to this problem.

31968-small_screenshot.png

I solved it.

I put an script on the Maps GameObject.
It uses an IEnumerator function as follows:

IEnumerator Presentation()
{
    Transform items = GetComponentInChildren<Transform>();
    foreach (Transform i in items)
    {
        //do stuff
        yield return new WaitForSeconds(0.05f);
    }
}