#Preloading or OnReady error

6 messages · Page 1 of 1 (latest)

agile zephyr
#

Hello, I would like advises from the community,
I have a problem, that I can figure out...

I'm trying to implement a health system like in Zelda games : multiples hearts, that can be full or damaged.
My GameController call the HealthGUI that instantiate a number of HeartGUI depending on the player health.

But I have an error when instantiating a preloaded scene.
This error can be skipped be removing the @onready annotation
but then I have errors because the HeartGUI methods are called before it's ready

I'm pretty sure I'm doing something out of order but can't see where...

burnt fulcrum
#

the preload does not have to be an @onready var. It can even be a constant

agile zephyr
burnt fulcrum
#

wait for a frame before updating the UI the first time

agile zephyr
#

But it feels hacky to do that
is it a normal thing to do with UI elements ?