Reputation: 471
I am developing a bevy application with bevy v0.15.1 and bevy_asset_loader v0.22.0 and the 3d feature enabled. My Problem is now that it seems that the loaded assets type seems to be not of Handle.
Heres a simplified version of my code:
#[derive(Clone, Eq, PartialEq, Debug, Hash, Default, States)]
pub enum GameState {
#[default]
Loading,
Game
}
#[derive(AssetCollection, Resource)]
pub struct ShipAssets {
#[asset(path = "3d/ships/boat-sail-a.glb")]
sail_a: Handle<Scene>,
#[asset(path = "3d/ships/boat-sail-a.glb")]
sail_b: Handle<Scene>,
}
fn main() {
App::new()
.add_plugins(DefaultPlugins)
// load
.init_state::<GameState>()
.add_loading_state(
LoadingState::new(GameState::Loading)
.continue_to_state(GameState::Game)
.load_collection::<ShipAssets>()
.load_collection::<MapAssets>()
)
.app.add_systems(Startup, spawn_ship.run_if(in_state(GameState::Game)))
.run();
}
fn spawn_ship(mut commands: Commands, ship_assets: Res<ShipAssets>) {
commands.spawn(
(
SceneRoot(ship_assets.sail_a.clone()),
Transform::from_xyz(0.0, 0.0, 0.0),
)
);
}
The code compiles but no ship is displayed (I removed the camera code to keep the example as short as possible) and I get the follwing error:
025-01-25T00:22:53.704629Z ERROR bevy_asset::server: Could not find an asset loader matching: Loader Name: None; Asset Type: None; Extension: None; Path: Some("3d/ships/boat-sail-a.glb");
025-01-25T00:22:53.704629Z ERROR bevy_asset::server: Could not find an asset loader matching: Loader Name: None; Asset Type: None; Extension: None; Path: Some("3d/ships/boat-sail-b.glb");
If I just use the asset_server instead of bevy_asset_loaders AssetCollection
and replace ship_assets.sail_a.clone()
with asset_server.load(GltfAssetLabel::Scene(0).from_asset("3d/ships/boat-sail-a.glb")),
it works fine.
Can bevy_asset_loader even load .glb files as Handle or is my setup just not correct?
Upvotes: 2
Views: 60