mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
Merge pull request #1470 from Zirak/patch-2
Demonstrate coroutine's completed signal
This commit is contained in:
committed by
mhilbrunner
parent
72186e098c
commit
e70691b8e9
@@ -1385,6 +1385,21 @@ signal is received, execution will recommence. Here are some examples:
|
||||
# Wait 5 seconds, then resume execution
|
||||
yield(get_tree().create_timer(5.0), "timeout")
|
||||
|
||||
Coroutines themselves use the ``completed`` signal when they transition
|
||||
into an invalid state, for example:
|
||||
|
||||
::
|
||||
|
||||
func my_func():
|
||||
yield(button_func(), "completed")
|
||||
print("All buttons were pressed, hurray!")
|
||||
|
||||
func button_func():
|
||||
yield($Button0, "pressed")
|
||||
yield($Button1, "pressed")
|
||||
|
||||
``my_func`` will only continue execution once both the buttons are pressed.
|
||||
|
||||
Onready keyword
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
Reference in New Issue
Block a user