#@onready variables not working

1 messages · Page 1 of 1 (latest)

winged meadow
#

charachterbody2d.facing prints properly but cutscenemanager.testvar causes everything to crash.
I am trying to set a variable in cutscene manager so that it can find something in a dictionary and show to screen.
ex interact w object and the object sets cutscenemanager.dialogueId to 4 and then playes the 4th dialogue in the json but for whatever reason it crashes whenever i call this.

winged meadow
#

from what i can tell it appears to be that areea 2d and node 2d are not compatable as the issue doesent exist with node 2d nodes connected to node 2ds but does exist with node 2ds connecting to area 2ds and vise versa

arctic shadow
#

if print is not working then your node path is wrong

winged meadow
#

managed to figure it out finally
me problem was cutscene_manager.tscn was global but not cutscene_manager.gd
i thought that cutscene manager would be able to cvonnect due to it being a child of charachterbody 2d but somehow this wasnt the case and it sent me on a wild goosechase (:

random path
#

If this is the cutscenemanager script, then one typo I see is that you're printing testvar, but your test variable is just named test, which would definitely cause an error

#

Don't really need to put self into a variable either, you can just print(test)

#

$"." Is just the node path for self, aka the node you're already in

winged meadow
random path
#

Don't rely on onready node paths to get references like that in autoloads though, cause the autoload is loaded before everything else it won't find your character body