Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option for the plugin to skip setting an initial state #47

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

will-hart
Copy link

Background

While integrating this into a template which used bevy_asset_loader I found that there was a little bit of friction as both plugins wanted to manage state. In particular, the leafwing ManifestPlugin automatically sets the game to AssetLoadingState::LOADING when the plugin is added. I still want leafwing_manifest to manage manifest processing states, but I don't want it to control my application setup which seems to be the current behaviour.

I think this is different from automatically_advance_states, in that Having this allows me to explicitly control when I hand over control of the application state to leafwing_manifest by triggering the right state transition. (Its definitely possible I've missed a more obvious approach😁)

Changes

The default behaviour is unchanged. The changes are:

  1. add a set_initial_state flag to ManifestPlugin, which defaults to true,
  2. in ManifestPlugin::build check set_initial_state is true before calling app.insert_state(S::LOADING).
  3. made the Default impl for ManifestPlugin generic across AssetLoadingStates, which might resolve ManifestPlugin's Default impl is specific to SimpleAssetState #46 ?
  4. added an example of how to integrate with "preloaded" / preprocessed assets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ManifestPlugin's Default impl is specific to SimpleAssetState
1 participant