Skip to content

Ordered OnExit and OnEnter #13711

Description

@MiniaczQ

What problem does this solve or what need does it fill?

Currently OnExit and OnEnter aren't ordered in relation to the state dependency graph.
This is a problem when parent state transition prepares e.g. resources for substates, but the OnEnter(Substate) runs first.

What solution would you like?

  • Order OnExit to run from graph leaf-states to root-states.
  • Keep OnTransition in arbitrary order.
  • Order OnEnter to run from graph root-states to leaf-states.

This can either be done by adding after conditions during state installation or as part of StateRegistry, a separate feature.

What alternative(s) have you considered?

None that seem reasonable.

Additional context

This could be considered a bug to some degree.

Working example, entering Settings will crash or not, depending on the system order that was decided during startup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorX-ContentiousThere are nontrivial implications that should be thought through

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions