Loaders doesn't work

Hi all!
Please help!

I am having an error when trying to load gltf file:

RuntimeError: Unable to load from /meshes/mesh.gltf: importMesh of unknown

Here is my code:

import { SceneLoader } from '@babylonjs/core/Loading';
import '@babylonjs/loaders';

console.log(SceneLoader.IsPluginForExtensionAvailable('gltf'));
// => false

SceneLoader.OnPluginActivatedObservable.add(console.log); 
// => {name: 'babylon.js', extensions: '.babylon', ...

SceneLoader.ImportMeshAsync(['mesh'], '/meshes/', 'mesh.gltf', scene, null, 'gltf').then(console.log);

After forcing loader to use gltf in ImportMeshAsync method also seeing this in console:

Unable to find a plugin to load gltf files. Trying to use .babylon default plugin.

Versions:

    "@babylonjs/core": "^5.1.0",
    "@babylonjs/loaders": "^5.1.0",

Thank you!

I think it should be .gltf - notice the leading dot.
Babylon.js/glTFFileLoader.ts at master · BabylonJS/Babylon.js (github.com)

2 Likes

you are my hero