![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Florentin |
Hey fellow godot devs,
I am currently experiencing an issue in godot 3.5.1, where a PackedScene does not get instantiated when I call .instance() in the _ready() function.
E.g.:
export (PackedScene) var platform_scene
func _ready():
var platform = platform_scene.instance()
platform.translation = Vector3(0, 0, 0)
get_parent().add_child(platform)
will not work (no errors and no platform).
However if I add a timeout, it will work:
func _ready():
yield(get_tree().create_timer(0.1), "timeout")
var platform = platform_scene.instance()
platform.translation = Vector3(0, 0, 0)
get_parent().add_child(platform)
Do you know why this is the case and how to fix this without a timeout?
get_parent() seems to be the culprit but I am currently not sure why.
Cheers