Godot Version
4.6.3
Question
EDIT: This question was nonsense, disregard it.
Clearly I still have not understood the documentation correctly. It says: “However, if you don’t depend on the result, you can just call it asynchronously, which won’t stop execution and won’t make the current function a coroutine”.
Say I have the following toy class, which just holds a callback that may or may not be a coroutine (hence the ignored warning).
class_name Action extends Node
var callback: Callable
var arguments: Array
signal finished
func _init(
cb: Callable,
...args
) -> void:
self.callback = cb
self.arguments = args
func do() -> void:
@warning_ignore("redundant_await")
await callback.bindv(arguments).call()
finished.emit()
Now I create two of these with animations inside and want to play them at the same time, then wait until both are finished (which is what the signal is for).
var a = action.new(some_animation)
var b = action.new(more_animation)
@warning_ignore("missing_await")
a.do()
@warning_ignore("missing_await")
b.do()
This results in the game waiting until some_animation is finished before starting more_animation. Why?
In case it matters, the code above is called in _process, where I maintain a queue of such “batches” of coroutines, wait until I get the finished signal from each coroutine in the current batch, and then want to fire all coroutines in the next batch at once. Except Godot refuses to call them at the same time.