# Silent failure to load .obj?

**URL:** <https://forum.babylonjs.com/t/silent-failure-to-load-obj/28554>\
**Category:** Questions\
**Created:** [March 18, 2022, 11:59pm UTC](https://forum.babylonjs.com/t/silent-failure-to-load-obj/28554 "2022-03-18T23:59:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ajp/32/9504_2.png) [@ajp](https://forum.babylonjs.com/u/ajp)\
**Post date:** [March 18, 2022, 11:59pm UTC](https://forum.babylonjs.com/t/silent-failure-to-load-obj/28554/1 "2022-03-18T23:59:03Z")

</div>

I am attempting to load an .obj file into babylonjs but it appears to be silently failing as `BABYLON.SceneLoader.ImportMeshAsync` gives `result.meshes` with no elements in it.

There is a repo here: [GitHub - AJamesPhillips/3d\_sandbox](https://github.com/AJamesPhillips/3d_sandbox)  
Which you can get running using:

```auto
npm install
npm run dev

```

Then:

- navigate to [http://localhost:3000](http://localhost:3000)
- open console, refresh page, and you should hit a debugger here: [3d\_sandbox/create\_tree.ts at acc5339407888fd6e92d14bc99ca0a44c78683b5 · AJamesPhillips/3d\_sandbox · GitHub](https://github.com/AJamesPhillips/3d_sandbox/blob/acc5339/src/components/create_tree.ts#L8-L14)

I don’t observe any error, it’s just that no meshes are present.  
When I drag [the same .obj](https://github.com/AJamesPhillips/3d_sandbox/blob/main/public/models/low_poly_tree/lowpolytree.obj) into [https://sandbox.babylonjs.com/](https://sandbox.babylonjs.com/) it seems to work as expected.  
I’ve read the docs so any tips / pointers on how to debug this would be appreciated.

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![brianzinn](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/brianzinn/32/28013_2.png) [@brianzinn](https://forum.babylonjs.com/u/brianzinn)\
**Post date:** [March 19, 2022, 4:58am UTC](https://forum.babylonjs.com/t/silent-failure-to-load-obj/28554/2 "2022-03-19T04:58:42Z")

</div>

why not use the ES6 libraries `@babylonjs/core` and `@babylonjs/loaders`. You can read about the side loading here - there is an optimization if you know you are only loading OBJ files:  
[Babylon.js ES6 support with Tree Shaking | Babylon.js Documentation (babylonjs.com)](https://doc.babylonjs.com/divingDeeper/developWithBjs/treeShaking#loaders)

edit: I didn’t run your repo to diagnose, but just looked at it briefly - I’m sure there is a solution using that library, but you will not get tree shaking benefits.

---

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ajp/32/9504_2.png) [@ajp](https://forum.babylonjs.com/u/ajp)\
**Post date:** [March 19, 2022, 9:12am UTC](https://forum.babylonjs.com/t/silent-failure-to-load-obj/28554/3 "2022-03-19T09:12:13Z")

</div>

> [@brianzinn](#):
>
> why not use the ES6 libraries `@babylonjs/core` and `@babylonjs/loaders`

Thanks! I will give these a go. I am using the babylonjs-loaders library because when I searched for “[babylonjs import .obj](https://www.google.com/search?q=babylonjs+import+.obj)” the first link to the [documentation was this one](https://doc.babylonjs.com/divingDeeper/importers/oBJ). Should we change the documentation to use those two libraries instead?

---

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ajp/32/9504_2.png) [@ajp](https://forum.babylonjs.com/u/ajp)\
**Post date:** [March 19, 2022, 11:59am UTC](https://forum.babylonjs.com/t/silent-failure-to-load-obj/28554/4 "2022-03-19T11:59:47Z")

</div>

I did not understand that the first argument was used to filter the meshes by their name. I thought it was used to assign their name. When I replace this first argument with `null` it works as expected.
