I am finding a weird behavior while loading textures. When I use the below line of code, it loads the model with textures:
BABYLON.SceneLoader.ImportMeshAsync(null, "Models/Car/", "scene.gltf", scene);
However when I try to load the model through a keyboard key, it loads the model but the textures are missing. Why does this behavior occur? The code that I am facing problem with is given below:
scene.onKeyboardObservable.add(async(kbInfo) => {
switch (kbInfo.type) {
case BABYLON.KeyboardEventTypes.KEYUP:
switch (kbInfo.event.key) {
case " ":
await BABYLON.SceneLoader.ImportMeshAsync(null, "Models/Car/", "scene.gltf", scene);
break;
}
break;
}
});
Also, it is not the issue with the model, this is the third model I am trying with. Yet the problem persists.