Skip to content

Lifecycle API #2432

@zmerp

Description

@zmerp

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

Android and XR apps often needs to keep track of the app lifecycle state and react differently to each of them. State-aware behavior is also often needed by backends an plugins implementations.

What solution would you like?

Some alternatives are:

  • .add_*_system(), where * is the name of a lifecycle state (or event). This follows the current .add_startup_system().
  • .add_system(my_system.when::<LifecycleState>())
  • .add_system_to_schedule(my_system, LifecycleState). .add_system() will be an alias for the running/steady state systems.

Possible names for the states:

  • Startup/OnCreate/Enter
  • Resume/OnResume/Resuming
  • Update/Running
  • Pause/OnPause/Pausing
  • OnDestroy/Exit

User resources are available in all states, but engine provided resources might not be available in every state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-FeatureA new feature, making something new possibleS-Needs-Design-DocThis issue or PR is particularly complex, and needs an approved design doc before it can be merged

    Type

    No type

    Projects

    Status

    Tangentially Related

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions