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

Loading folders is not supported on Android and Web #43

Open
inodentry opened this issue Feb 16, 2024 · 3 comments
Open

Loading folders is not supported on Android and Web #43

inodentry opened this issue Feb 16, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@inodentry
Copy link

inodentry commented Feb 16, 2024

Older (before Bevy 0.12) versions of bevy_fluent supported providing a Vec of asset handles for the locale bundles.

The current (Bevy 0.12) version switched to using LoadedFolder (new API that came with the Bevy 0.12 assets rework).

However, some platforms do not support the asset_server.load_folder API. Notably Web/WASM and Android.

I can no longer run projects that use bevy_fluent on these platforms.

I want to make a mobile port of my game, but it seems like it is no longer possible, because LocalizationBuilder requires LoadedFolder.

Can you please also support using a simple Vec of asset handles instead?

It would also have the benefit that it would allow me to organize my locale assets differently if I want, instead of requiring them to be all in a single folder.

@quinnromanek
Copy link

Wanted to +1 this - bevy_asset_loader (a common loading state plugin) also doesn't support loading LoadedFolders, only Vec<UntypedHandle>.

@kgv
Copy link
Owner

kgv commented Mar 24, 2024

I plan to address this issue in the new API (#37).
Loading will be done using Asset settings.
Waiting:

@kgv kgv added the enhancement New feature or request label Mar 24, 2024
@Selene-Amanita
Copy link

Selene-Amanita commented May 20, 2024

A way to get around it with bevy_asset_loader is to have a Vec<UntypedHandle> and then have a system/resource like that when it finishes loading the vec (OnExit(LoadedState)):

fn create_locales_loaded_folder_handle(
    mut commands: Commands,
    assets: Res<LocalizationAssets>,
    mut loaded_folders: ResMut<Assets<LoadedFolder>>,
) {
    commands.insert_resource(LocalesLoadedFolderHandle(loaded_folders.add(
        LoadedFolder {
            handles: assets.locales.clone(),
        },
    )));
}

I think if you load every file one by one in the vec using a list of path: https://github.com/NiklasEi/bevy_asset_loader?tab=readme-ov-file#list-of-paths you can do that for the android and web build, but that's tedious.

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

No branches or pull requests

4 participants