Hi all, I’m having trouble with the following code:
@onready var powerFSM = $PowerStates
For whatever reason, this specific variable returns null, even though the name of the node matches and the other onready variables in this script all return proper values. Here is my scene tree:
I’ve tried that, and still an error. It’s worth mentioning that when i ctrl + click the PowerStates node, the colon autofills to Node even though PowerStates is of custom type StateContainerMachine.
this looks like the relevant part of the script. I still dont fully understand, but maybe it has something to do with how the variables are initialized here?
the onready var is targetting a var in player named powerFSM so if you don’t want to do the line replacement go in the script of player and try to locate the var
yep, it was because the player (which starts in state idle) immediately begins to fall, so the state is switched before the variable is ready. Thanks for the tip
edit: after switching the initial player state the player now falls for a bit before the game crashes. the powerFSM variable is still initialised as null before the transition occurs, but if im not mistaken, the ready state should have occured by that point… what could be going on?