Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when calling a coroutine with await in _ready #44101

Closed
pouleyKetchoupp opened this issue Dec 4, 2020 · 3 comments · Fixed by #44104
Closed

Error when calling a coroutine with await in _ready #44101

pouleyKetchoupp opened this issue Dec 4, 2020 · 3 comments · Fixed by #44104
Assignees
Milestone

Comments

@pouleyKetchoupp
Copy link
Contributor

Godot version:
Master 2a0de6d

OS/device including version:
Windows 10

Issue description:
Calling a coroutine in _ready() using await fails with error Trying to call an async function without "await".

Example script:

extends Node

func _ready():
	await get_tree().create_timer(1.0).timeout # works
	await _async_func_test() # fails

func _async_func_test():
	await get_tree().create_timer(1.0).timeout

Steps to reproduce:

  1. Add the script above to a node
  2. Start game
  3. Observe debugger break and error

Minimal reproduction project:
script-await-ready.zip

@pouleyKetchoupp
Copy link
Contributor Author

Fixed in #43890, closing.

@pouleyKetchoupp
Copy link
Contributor Author

I thought it was fixed, but I can actually still reproduce it in 68117f5.

@epth
Copy link

epth commented Dec 21, 2020

same error,sample code:

extends Button

func _ready():
	await wait_confirmation()

func wait_confirmation() -> void:
	print("Prompting user")
	await self.button_up # Waits for the button_up signal from Button node.
	print("User confirmed")

Run the code will give this error: Trying to call an async function without "await".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants