Open derkork opened 3 weeks ago
As a workaround one can delay the sending of the event by one frame, e.g.
func _state_a_state_entered():
$StateChart.send_event.call_deferred("some_event")
We will also need this same process for state exiting.
Assume you have this setup:
If we start this,
A
is entered, which triggers the sending ofsome_event
. But becauseB
is not yet entered (in parallel states states are entered one by one),B
is technically not yet active which is whyB1
never gets thesome_event
event delivered so while we should end up with stateB2
active, we end up withB1
active. We will need some two-phase state entering mechanism, where we first finalize all state entering and only fire the event handlers once the new state is propagated through the state chart.