Toggling lights in a specific order using editor-available variables

I am looking to control the order in which the light object and materials become switched on in a room, to make them turn on in a circle pattern, or moving away from the player etc (real cinematic stuff :p).

I tried different things but had immense trouble actually splitting the strings and using them to switch, which is why I am here.

I have added some block comments at the top of this script (which I have emptied) which explains better what I am trying to do.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/*
What I want to be able to do is, when TurnLights(true) is called, the lights come on (their material is changed to on and whatnot) in groups.
To exemplify, I have a circle of 6 lights, 60 degrees between each to create a circle (more of a hexagon really) and I want to switch them on like so, 1, then 2 and 6, then 3 and 5, then 4.
This would be done by setting order's first string to 1, the second to 2,6, the third to 3,5 and the fourth to 4.
This is where the orderDelay comes in, a delay of x seconds is used to space out these groups.

    How would this be achieved?
*/

public class LightOnInOrder : MonoBehaviour
{
    public Material on;                 //Material to switch to when on
    public Material off;                //Material to switch to when off

    public int orderDelay;              //Delay (seconds) between each set being switched

    public List<GameObject> lights;     //The lights (will use GameObject.GetComponent<Renderer> to assign materials)
    public List<string> order;          //The order in which the lights shall be switched (think groups)

    IEnumerator TurnLights(bool state)  //Will be switched by callable function controllable via the editor
    {
        return null;                    //Gets rid of pesky errors
    }
}

Does anyone have any ideas on how I would do this robustly and with a generic enough solution that I could use it with any number of lights and objects etc…?

Well, Unity suggests you use the animation system of course.

However, for cheap-and-cheerful jobs like what you’re talking about, where I never intend to hand it off to an artist, I like to just code it up myself.

See the attached unitypackage for a little “code monkey’s animator” system that will sequence GameObjects on, including GameObjects that have yet another sequencer on them!

2956382–219340–SequenceGameObjectsOn.unitypackage (5.92 KB)