This repository has been archived by the owner on Sep 16, 2021. It is now read-only.
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.
States: possible to accidentally run multiple states at once #393
Open
Description
This bug took me a long time to find:
Do to the order states are initiated in:
function enter<T>( _state:State, ?_enter_with:T ) {
//order matters
_state.onenter( _enter_with );
active_states.push( _state );
active_count++;
_state.active = true;
} //enter
if you attempt to set()
at new state, while in onenter()
of the current state, it has not yet been added to the active states, so when it attempts to leave, it actually does nothing, and continues running its update (along with the new states update).
I'm wondering if onenter()
should just be called after the other initialisation? don't see why that would be wrong but I haven't delved into any other code of how these run.
I also wonder why there is a list of active states? is there some way of running states concurrently?
(ah oops ignore that one, just saw the enable/disable, leaving to note that their logic also likely allows for these ghost states)
Nico
Metadata
Assignees
Labels
No labels
Activity