Skip to content

MeroVinggen/Godot-AwaiterPlugin

Repository files navigation

Godot awaiter plugin Icon

Awaiter Plugin

Support me on Ko-fi

Support me on Ko-fi

See my other plugins

About

A plugin for managing asynchronous tasks in Godot. Await multiple signals, frames or async calls with intuitive helpers: all(), any(), and some().

Features

  • use await or signals seamlessly
  • built-in progress and done signals
  • wait for all async tasks to finish with Awaiter.all()
  • wait for any task to finish with Awaiter.any()
  • wait for N tasks to finish with Awaiter.some()
  • wait for N frames to pass via Awaiter.process_frames/physics_frames()

Requirements

  • Godot 4.2 or higher

Installation

  • Open the AssetLib tab in Godot with your project open
  • Search for Awaiter plugin and install the plugin by Mero
  • Open Project -> Project Settings -> Plugins Tab and enable the plugin Awaiter
  • Done!

Usage examples

  • usage via signals
# pass signals and async funcs
var task_manager: Awaiter._TaskManager = Awaiter.all([
  signal1,
  func1,
  ...
])

task_manager.done.connect(_on_done)
task_manager.progress.connect(_on_progress)
  • inline usage
# pass signals and async funcs
var results = await Awaiter.all([
  signal1,
  func1,
  ...
]).done
  • awaiting 5 physics frames
	await Awaiter.physics_frames(5).done

Methods

all - waiting for all of the tasks to complete

Awaiter.all(tasks: Array[Signal | Callable]) -> _TaskManager

any - waiting for any of the tasks to complete

Awaiter.any(tasks: Array[Signal | Callable]) -> _TaskManager

some - waiting for <n> amount of the tasks to complete

Awaiter.some(tasks: Array[Signal | Callable], amount_to_complete: int) -> _TaskManager

process_frames - waiting for <n> process frames to pass

Awaiter.process_frames(target_frames_count: int) -> _FramesAwaiter

physics_frames - waiting for <n> physics frames to pass

Awaiter.physics_frames(target_frames_count: int) -> _FramesAwaiter

Signals

done(result: Array) - is emitted after completion (depending on used method)

progress(complete: int, total: int) - is emitted per complete task

Tutorials

About

A plugin for managing asynchronous tasks in Godot. Await multiple signals, frames or async calls with intuitive helpers: all(), any(), and some().

Topics

Resources

License

Stars

Watchers

Forks

Contributors