Delaying Event Execution

UdonSharp Code equivalent:

float delayedTime;
bool isDelayActive;

void Interact()
{
   delayedTime = Time.time + 5f;
   isDelayActive = true;
}

void Update()
{
    if (isDelayActive && Time.time > delayedTime)
    {
        DelayedEvent();
        isDelayActive = false;
    }
}

void DelayedEvent()
{
    Debug.Log("Hello World!");
}
3 Likes