Dogan Kirnaz
  • Welcome
  • Setup
    • Quickstart
  • Basics
    • Agent Extensions
    • Audio Extensions
    • Camera Extensions
    • Collision Extensions
    • Coroutine Extensions
    • Encryption Extensions
    • Format Extensions
    • Game Extensions
    • Json Extensions
    • List Extensions
    • Loop Extensions
    • Material Extensions
    • Math Extensions
    • GameObject Extensions
    • Physics Extensions
    • Object Pool Extensions
    • Scene Extensions
    • PlayerPrefs Extensions
  • Support
    • Support
Powered by GitBook
On this page
  1. Basics

Coroutine Extensions

Start Coroutine

This line initiates a coroutine that executes the MyFunction function after a specified delay. By setting the delay parameter to 1 second, the function is scheduled to run after a brief pause.

CoroutineExtensions.StartCoroutine(MyFunction, 1f);

void MyFunction()
{
    Debug.Log("This is executed after 1 second delay!");
}

Start Polling Coroutine (Condition-based Coroutine)

This line initiates a polling coroutine that checks the condition boolean every 0.1 seconds as default. The delay time can be adjusted as required. When the condition turns true, the coroutine executes the MyFunction function and turns the condition false.

bool condition = true;

CoroutineExtensions.StartPollingCoroutine(ref condition, MyFunction);

void MyFunction()
{
    Debug.Log("This is executed after condition met!");
}

Start Sequence

This line initiates a coroutine sequence, adding functions to execute in a specific order with delays between each. Here, MyFunction1 is called after a 1-second delay, followed by MyFunction2 with a 1-second delay, and finally MyFunction3 with another 1-second delay. Once all functions are appended, the sequence begins by calling Play().

CoroutineExtensions.StartSequence()
        .Append(MyFunction1, 1f)
        .Append(MyFunction2, 1f)
        .Append(MyFunction3, 1f)
        .Play();
PreviousCollision ExtensionsNextEncryption Extensions

Last updated 24 days ago