SceneLoader cant load gltf2.0 file but sandbox can load

env:
@babylonjs/core@6.27.1
@babylonjs/loaders@6.27.1

code:

SceneLoader.RegisterPlugin(new GLTFFileLoader());
        return SceneLoader.AppendAsync(
            "/static/3d/lopoly_planet/",
            "scene.gltf",
            this.sceneObj,
            (ev) => {
                console.log({
                    type: "scene-change",
                    stage: 2,
                    progress: Math.round((ev.loaded * 100) / 1233094) / 100,
                });
            }
        );

error info:
sceneLoader.ts:1004 Uncaught (in promise) RuntimeError: Unable to load from /static/3d/lopoly_planet/scene.gltf: Unsupported version: 2.0

Fix by:
import “@babylonjs/loaders/glTF/2.0/glTFLoader”;
to avolid tree shake
this should document , i think

It’s documented here:

I think you should use import "@babylonjs/loaders/glTF"; instead of import “@babylonjs/loaders/glTF/2.0/glTFLoader”;, as per the doc, else some glTF may not load.

2 Likes