You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using vars that are set with @onready (or in _ready()) are still unset when the Initial State is first Entered.
Only workaround I have found, for nodes use $Node/Path or get_node(). For dynamic vars, would need to be hard-coded.
I have not found an elegant way around this to "fix", and there may not be. A note or warning may be nice about the load order of when in runs the initial state enter signal.
The text was updated successfully, but these errors were encountered:
Red3Tango
changed the title
OnReady vars null on default enter state
OnReady vars null on initial enter state
Aug 31, 2023
I think this is caused by the recent change that ensures that state changes happen in the same frame. It could be fixed by delaying entering the initial state of the state chart by one frame, to ensure that the full tree is ready.
I'll build a new release with this change as i think this makes more sense than the current implementation but I will not be able to do it today. As a temporary workaround you can change this line in state_chart.gd which should delay the state entering by one frame:
Using vars that are set with
@onready
(or in_ready()
) are still unset when the Initial State is first Entered.Only workaround I have found, for nodes use
$Node/Path
orget_node()
. For dynamic vars, would need to be hard-coded.I have not found an elegant way around this to "fix", and there may not be. A note or warning may be nice about the load order of when in runs the initial state enter signal.
The text was updated successfully, but these errors were encountered: