godotengine / godotengine/godot-docs
Document/clarify the execution order of multiple functions `await`-ing the same signal callback (Seems to preserve order).
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**NOTE: `get_tree().physics_frame.connect(_printing_func, CONNECT_ONE_SHOT)` executes in the same order as `await`-ing.**
---
**Your Godot version:**
3.5.3.stable, 4.1.3.stable, and 4.2.stable
**Issue description:**
From what I see, the order is **always preserved**.
Attach script to all nodes:
- Root
- A
- B
```gdscript
extends Node
func _enter_tree() -> void:
await get_tree().physics_frame
print("_enter_tree: ", name)
func _ready() -> void:
await get_tree().physics_frame
print("_ready: ", name)
```
And this should "work" with both process_frame and physics_frame
Output in 3.5.3.stable, 4.1.3.stable, and 4.2.beta6:
```
_enter_tree: Root
_enter_tree: A
_enter_tree: B
_ready: A
_ready: B
_ready: Root
```
This order might break if an underlying data structure changes.
MRP:
[godot3_test1.zip](https://github.com/godotengine/godot-docs/files/13361048/godot3_test1.zip) uses yield instead
Godot 4: [test2.zip](https://github.com/godotengine/godot-docs/files/13361053/test2.zip)
**URL to the documentation page (if already existing):**
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.