EasyCoroutine - Godot Coroutine Management Plugin

📦 Installation Guide
- Copy the
EasyCoroutine
folder to your project's addons/
directory
- In Godot Editor, navigate to
Project Settings -> AutoLoad
- Add
CoroutineManager.cs
as an autoload script (recommended name: CoroutineManager
)
- 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 |
WaitForTask |
Wait task completion |
WaitForSignal |
Wait signal emit |
🔗 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");
}