I cant assign this to var..

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ArkadiuszWernicki

Why Godot gives me bug with this?

…Sorry for my english…

:bust_in_silhouette: Reply From: Zylann

Because member variables get initialized when the script instance is created. This happens before your node entered the scene tree, so you cannot query child nodes or parents at this time.

To solve this, use onready var. This will make your initialization code run when the node and its children will have entered the tree.