Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

EasyCoroutine

An asset by Noper
The page banner background of a mountain and forest
EasyCoroutine hero image

Quick Information

0 ratings
EasyCoroutine icon image
Noper
EasyCoroutine

Core Features:Supports diverse waiting modes: time-based delays (WaitForSeconds), physics frame synchronization (WaitForNextPhysicsFrame), Tween animation completion (WaitForTween), inter-coroutine dependencies (WaitForOtherCoroutine), and custom event locks (WaitForUnlock).Simplified asynchronous programming with yield syntax, enabling and more.sequential-style code execution across frames.

Supported Engine Version
4.0
Version String
1.0.2
License Version
MIT
Support Level
community
Modified Date
14 days ago
Git URL
Issue URL

EasyCoroutine - Godot Coroutine Management Plugin

README Godot 4.x README License: MIT

📦 Installation Guide

  1. Copy the EasyCoroutine folder to your project's addons/ directory
  2. In Godot Editor, navigate to Project Settings -> AutoLoad
  3. Add CoroutineManager.cs as an autoload script (recommended name: CoroutineManager)
  4. Ensure the node exists in scene tree for automatic coroutine system initialization

🛠️ Basic Usage

Starting Coroutines

// Start coroutine in any node
Coroutine.StartCoroutine(TestCoroutine());

IEnumerator<ulong> TestCoroutine()
{
    GD.Print("Coroutine launched");
    yield return Coroutine.WaitForSeconds(1.5f);
    GD.Print("Executed after 1.5 seconds");
}

Wait Types Reference

Wait Method Description
WaitForSeconds Wait specified seconds
WaitForTimeSpan Wait custom time interval
WaitForNextPhysicsFrame Wait next physics frame
WaitForTween Wait Tween animation completion
WaitForUnlock Wait custom event lock (multi-agent support)
WaitForOtherCoroutine Wait other coroutine completion

🔗 Examples

Event Lock Mechanism

var attackLock = Coroutine.CreateLock();

IEnumerator<ulong> AttackSequence()
{
    GD.Print("Charging started");
    yield return Coroutine.WaitForSeconds(2f);
    attackLock.Unlock();
}

IEnumerator<ulong> WaitAttack()
{
    GD.Print("Waiting for attack completion");
    yield return Coroutine.WaitForUnlock(attackLock);
    GD.Print("Attack released");
}

Tween Coordination

IEnumerator<ulong> MoveCharacter()
{
    var tween = CreateTween();
    tween.TweenProperty(GetNode<Sprite2D>("Sprite"), "position", new Vector2(300, 200), 1.5f);
    
    yield return Coroutine.WaitForTween(tween);
    GD.Print("Movement completed");
}

Coroutine Dependency

IEnumerator<ulong> CoroutineA()
{
    GD.Print("Coroutine A started");
    yield return Coroutine.WaitForSeconds(2f);
    GD.Print("Coroutine A completed");
}

IEnumerator<ulong> CoroutineB()
{
    GD.Print("Coroutine B started");
    yield return Coroutine.WaitForOtherCoroutine(Coroutine.StartCoroutine(CoroutineA()));
    GD.Print("Coroutine B completed");
}

Core Features:
Supports diverse waiting modes: time-based delays (WaitForSeconds), physics frame synchronization (WaitForNextPhysicsFrame), Tween animation completion (WaitForTween), inter-coroutine dependencies (WaitForOtherCoroutine), and custom event locks (WaitForUnlock).
Simplified asynchronous programming with yield syntax, enabling and more.sequential-style code execution across frames.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
EasyCoroutine icon image
Noper
EasyCoroutine

Core Features:Supports diverse waiting modes: time-based delays (WaitForSeconds), physics frame synchronization (WaitForNextPhysicsFrame), Tween animation completion (WaitForTween), inter-coroutine dependencies (WaitForOtherCoroutine), and custom event locks (WaitForUnlock).Simplified asynchronous programming with yield syntax, enabling and more.sequential-style code execution across frames.

Supported Engine Version
4.0
Version String
1.0.2
License Version
MIT
Support Level
community
Modified Date
14 days ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers