Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ArkadiuszWernicki |
…Sorry for my english…
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ArkadiuszWernicki |
…Sorry for my english…
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.