godotengine / godotengine/godot-docs
Function yield better not used inside _ready function
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**Your Godot version:**
2.1 it might applies to v3.x since the yielding function and the node source hasn't changed the yielding behavior
**Issue description:**
Using `yield` inside the `_ready` function might lead to an unexpected behavior that's really hard to reproduce.
I'm not sure, but it seems that using `yield` inside the `_ready` function might lead to a node duplication, it is quite rare and random, and really really hard to reproduce.
Also, while browsing old github issues, I found out [that comment](https://github.com/godotengine/godot/issues/5247#issuecomment-226645193), and I think it'd be better to add a note to the documentation of the yielding function explaining it's better to avoid yielding inside the `_ready` function.
**URL to the documentation page:**
https://docs.godotengine.org/fr/stable/classes/class_@gdscript.html#class-gdscript-method-yield
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.