#I have been trying to load assets for 5 hours

27 messages · Page 1 of 1 (latest)

vocal musk
#

With variations on this basic formula. I keep getting the error
Could not find an asset loader matching: Loader Name: None; Asset Type: None; Extension: None; Path: Some("models/ThunderBeat.png")

here's the code.

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup) 
        .run();
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    // Load the GLB file
    let glb_handle: Handle<Scene> = asset_server.load("models/ThunderBeat.png");

    // Spawn the GLTF scene into the world
    commands.spawn(SceneBundle {
        scene: glb_handle,
        ..default()
    });

    // Add a camera
    commands.spawn(Camera3dBundle {
        transform: Transform::from_xyz(0.0, 5.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
        ..default()
    });

    // Add a light source
    commands.spawn(PointLightBundle {
        transform: Transform::from_xyz(4.0, 8.0, 4.0),
        ..default()
    });
}
#

The image is just generi c

nimble vine
vocal musk
#

oh

#

I have tried loading blender scenes as glb

#

okay, i changed to this

#

same error probably

#

but i'll confirm

#

yyyup

#

same error when i load a blender scene

nimble vine
#

your models directory is in you assets folder right?

vocal musk
#

yes

#

assets/models/TestObj.glb

#

I have tried this with a vec of glbs

#

i have tried loading them as meshes instead of scenes

nimble vine
#

sorry idk whats wrong then

vocal musk
#

ty for trying

#

My goal is to use bevy-blender to load a level containing a directional light, camera, level geometry, and two players (with seperate structs)

#

but because of this frustrating error, i've been stuck without loading anything at all for 5 hours

noble lava
#

@vocal musk try doing let glb_handle: Handle<Scene> = asset_server.load("models/TestObj.glb#Scene0");

vocal musk
#

trying

noble lava
#

But that is a surprisingly poor error message, we should definitely improve it

vocal musk
#

holy hell

#

you've done it

noble lava
#

I think the problem is that .glb has a loader for the Gltf type, but you're trying to cast it to a Scene. Gltf can have multiple scenes though

#

So it just gives the generic "type A cannot be loaded from type B" message, even though you were so close