que es onready var

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

quisiera saber que es onready var ya que la uso y no se lo que es y quisiera aprender ya que quiero ver si la aplico en mas cosa y no solo para no dejar salir al jugador de la pantalla

1 Like
:bust_in_silhouette: Reply From: Wakatta


Onready is a keyword that basically states set the variable when it is ready
This is most useful with node’s and scenes as you may want to access or set properties that won’t be available until it is ready (which happens when the node is properly added to the scene tree)

Additional info

The onready var is the same as setting the var in the _ready() function of the requested node / scene
The variable is assigned before the _ready() func of the calling script but wont be set until its available so in cases where an error occurs its possible for the var to return null

muchas gracias

GURFREX | 2023-01-07 13:15

1 Like