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

Need to use handles from collection during loading state #77

Closed
inodentry opened this issue Aug 4, 2022 · 3 comments
Closed

Need to use handles from collection during loading state #77

inodentry opened this issue Aug 4, 2022 · 3 comments

Comments

@inodentry
Copy link
Contributor

I'd like to set up a loading screen with a progress indicator that shows the percentage ready.

However, to spawn the UI with the Text for the percentage indicator, I need a Handle to my Font.

bevy_asset_loader only inserts the AssetCollection when those assets have actually been loaded, meaning it is not available for me to access when entering the loading state, to set up my UI.

Is it possible to make an AssetCollection available from the start? The only way I see is from the example without using a loading state. However, I want to use a loading state. I just want to be able to use the handles when entering it.

It's okay if the handles point to assets that aren't loaded yet. I just need to setup my loading/splash screen. The UI will just "pop in" when those specific assets become available.

@NiklasEi
Copy link
Owner

NiklasEi commented Aug 4, 2022

What you describe should be doable by using init_collection on App for the collection that you want to access directly. This will however give you no guarantees about when the handles are loaded (I understand that's what you want here).

I would propose a different option: have a minimal loading state without loading screen. In that state you load only assets needed for the loading screen itself so it should be very fast. Then continue to the loading screen and show the progress UI from the beginning.

@NiklasEi
Copy link
Owner

NiklasEi commented Aug 4, 2022

In case you want to go with the init_collection solution:
You should be able to also track the collection you initialized, by adding it to the loading state as well as calling init_collection for it.

@NiklasEi
Copy link
Owner

I would close this for now as you can do this with init_collection as long as the assets are "simple", as in loaded directly and do not require post-processing (no dynamic assets, standard materials and so on).

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

No branches or pull requests

2 participants