godotengine / godotengine/godot

Editor plugin hooks return immediatly ignoring `await`

Open
#98,707 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion documentation topic:editor topic:gdscript topic:plugin
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

Tested versions

4.4.dev

System information

Windows 11 - Vulkan (Forward+)

Issue description

Coroutines don't work in EditorPlugin hooks like:

@tool
extends EditorPlugin

# The project runs immediately and "finished build check" prints after it
func _build() -> bool:
	print("awaiting _build")
	await get_tree().create_timer(3).timeout
	print("finished _build")
	return false

Other hooks used together with EditorPlugin like EditorExportPlugin._customize_resource also return immediately ignoring await. This makes it impossible to customize resources that depend on threaded features like NavigationMesh baking or the render thread.

Steps to reproduce

Run MRP. Build should not return because _build() in "res://addons/plugin/plugin.gd" returns false.
But it runs anyway and "Finished Build" is printed 3 seconds later.

Export MRP. It should print "finished _customize_resource" after exporting.
But it exports immediately and the message is printed 3 seconds later.

Minimal reproduction project (MRP)

plugin-await-issue.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked minimal reproduction project and inspect res://addons/plugin/plugin.gd, focusing on the _build() and _customize_resource hooks. Confirm the immediate-return behavior during Build and Export, then trace the corresponding EditorPlugin and EditorExportPlugin hook handling. Done means awaited hooks delay completion and the documented output order matches the issue.

Written by the indexing model from the issue text.

Assessment

Domain
game-dev, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.