Gltf loader crashing if i load a specific model

I have a very particular situation of a bug on loading using GLTFLoader

I have divided a space of my game in 10 parts, each with 20Mb of files. The first file has the walls, floor and top, the other 9 files has light, objects and stuff that are less important for the scene.

If I load all 10 files at once and then add them to the scene, all files load with no problem.

If I load the first file, put it in the scene and then after I load the 9 remaining files, the remaining 9 files have this error on load:

THREE.GLTFLoader: Couldn’t load texture
Promise {_state: 2, _handled: true, _value: TypeError: Cannot read properties of undefined (reading ‘createObjectURL’)

Trying to figure out what was going on…i came to the conclusion that all other files gives bug on loading if I load the user hand with this code:

let loader = new THREE.GLTFLoader();
let data={
loader.load( data.src, function ( gltf ) {
object = gltf.scene.children[ 0 ];

Fun fact is this hand loads alright. But it affects the loading of all other files.

Right now my code works if i load the hand after i load all other glb files. But I dont see why the order of load would affect the program. I found a solution but i didnt find the reason.

Also I noticed that after loading the files…when i put them in the scene there is a FREEZE in the game. Its like framerate dropped to 0 when adding to the scene and then after it returns to normal. Is it normal?

The snippet of code you’ve shared is unremarkable, I don’t think there’s much we can guess from this, but if your 3D models are having this problem, they are probably not performance-optimized.If you can share them, or live demo, that would help someone to debug.

If not – start by taking a look at the texture resolution and number of vertices. If you don’t know that information you can drop the models into and open the sidebar.

The freeze can be normal… it’s caused either by uploading a lot of texture data, compiling many different materials (likely if you’re spreading out similar objects in 10 parts, you may be duplicating all of the materials, causing 10x the number of material compiles), or both.

I ran your hand model through the excellent

It’s possible that the
“Node with a skinned mesh is not root. Parent transforms will not affect a skinned mesh.” may affect something later down the line?

This particular model looks pretty harmless — the remaining “game in 10 parts, each with 20Mb of files” is more likely to be an issue. Any textures with high resolution, in particular.