Coroutines how to make or another way

hi im want to make a show of light for a disco on the world im creating
but can make coroutines and the c# to udon give me error
on the beginning (public class lightscontrol : UdonBehaviour

my script is simple but seems not for udon

public class lightscontrol : UdonBehaviour
{

public GameObject red;
public GameObject blue;
public GameObject yellow;
public GameObject pink;
public float DelayTime;
public float roty;
public float rotz;
public float rotx;


void Start()
{
    red.SetActive(true);
    blue.SetActive(false);
    yellow.SetActive(false);
    pink.SetActive(false);
    StartCoroutine(Rotate());

}

private void Update()
{
    transform.Rotate(rotx, roty, rotz);
}

IEnumerator Rotate()
{
    red.SetActive(true);
    yield return new WaitForSeconds(DelayTime);
    red.SetActive(false);
    blue.SetActive(true);
    yield return new WaitForSeconds(DelayTime);
    blue.SetActive(false);
    yellow.SetActive(true);
    yield return new WaitForSeconds(DelayTime);
    yellow.SetActive(false);
    pink.SetActive(true);
    yield return new WaitForSeconds(DelayTime);
    pink.SetActive(false);
    yield return new WaitForSeconds(DelayTime);
    blue.SetActive(true);

    StartCoroutine(Rotate());
}
1 Like

Yeah, Coroutine is not supported. The closest thing we have is Special Nodes (SendCustomEventDelayedSeconds)

If you want it off the Udon thread, then using an animator is a option too, but that has it’s own limitations

1 Like

Pretty much what Phaxe said. At the moment you should use SendCustomEventDelayedSeconds to tell the UdonBehaviour to call a specific function in a certain number of seconds.

However, for what you’re doing (animating a disco light system), use a Unity animator instead.

1 Like

im gonna go with that way so
thanks

thank you so much i forget my best friend the animator

1 Like