![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Andre van Tonder |
Why are onready
variables referenced in another node null
in _ready()
?
For example:
in my game node:
onready var player = $Player
in my another node:
onready var game = $"/root/Game"
func _ready():
print(game.player) # null
If your other node is in the Game
scene, you can actually access the Game
node via the owner
property:
func _ready():
owner.player.shoot()
Dlean Jeans | 2019-06-05 16:50