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

Godot4-Coroutine

An asset by BimDav
The page banner background of a mountain and forest
Godot4-Coroutine hero image

Quick Information

0 ratings
Godot4-Coroutine icon image
BimDav
Godot4-Coroutine

Easy to use Coroutine functionality in Godot 4, such as resume() or join()

Supported Engine Version
4.0
Version String
0.3
License Version
MIT
Support Level
community
Modified Date
10 months ago
Git URL
Issue URL

Godot4-Coroutines

Easy to use Coroutine functionality in Godot 4

Resume

The Resume pattern is used to stop the execution in a subfunction, which will wait for its caller to call resume() for it to continue where it had stopped. See ResumeExample.tscn.

  • The resumable function must take a Coroutine as first argument. To stop execution, it must await on the Coroutine's resume_signal signal.
  • Create a Coroutine using var coroutine := Coroutine.new()
  • Call the resumable function using coroutine.resumable_call(my_resumable_function)
  • Note: use bindto add arguments to the call: coroutine.resumable_call(my_resumable_function.bind(arg1, arg2))
  • Execution in my_resumable_function()will stop on await coroutine.resume_signal
  • Resume the execution using coroutine.resume()
  • Once my_resumable_function()has finished, coroutine.is_completedis set to trueand the return value of my_resumable_function()is in coroutine.return_value

Join

Join is used to launch the execution of multiple functions, then waiting for them all to finish before continuing execution. See JoinExample.tscn.

  • Create a Coroutine using var coroutine := Coroutine.new()
  • Add a function you want to differ awaiting on using coroutine.add_future(my_joinable_function)
  • When all functions are added, use await coroutine.join() to wait for them all to finish

Easy to use Coroutine functionality in Godot 4, such as resume() or join()

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
Godot4-Coroutine icon image
BimDav
Godot4-Coroutine

Easy to use Coroutine functionality in Godot 4, such as resume() or join()

Supported Engine Version
4.0
Version String
0.3
License Version
MIT
Support Level
community
Modified Date
10 months 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