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

Implement Asset for Persistent<T> #37

Open
sgodwincs opened this issue Jan 18, 2024 · 1 comment
Open

Implement Asset for Persistent<T> #37

sgodwincs opened this issue Jan 18, 2024 · 1 comment

Comments

@sgodwincs
Copy link
Contributor

I use bevy_asset_loader for loading assets when entering a loading state. I wanted to load something using this crate as well and still get the same state management (progress/error/etc.) features provided by bevy_asset_loader.

In order to use it with this crate, Persistent<T> would need to implement Asset and have a custom AssetLoader along with registering them in the plugin. For bevy_asset_loader, it would also require custom DynamicAsset but that doesn't technically require any change in this crate (unless you'd want to support bevy_asset_loader behind a feature flag).

Two additional point:

  • Would have to access it via Res(Mut)<Assets<Persistent<T>>> instead of Res(Mut)<Persistent<T>> (only if loaded via AssetLoader, the existing codepath could keep it as the latter).
  • The AssetLoader::load returns a Future but this crate does synchronous loading. I'm assuming the work could be done on one of Bevy's task pools to avoid blocking. Or this crate could expose an async loading interface (maybe just internally for the AssetLoader).

Wanted to gauge whether this is something you'd want supported by this crate. If so, I'd be willing to send a PR out to do so. Let me know if I've missed anything, thanks!

@umut-sahin
Copy link
Owner

umut-sahin commented Jan 19, 2024

Thanks for the suggestion, it seems like a really cool feature!

I'd love to support it but I don't have much time at the moment. If you want to contribute, I'd be more than happy to help and review once it's ready. Otherwise, let's keep the issue open and I'll come back to it in a few weeks.

Thanks!

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