Why Can't AbstractMesh Be Recognized When Exporting the Scene as JSON Using SceneSerializer?

I used importMeshAsync to import a GLTF file into the scene, and it seems that all the models imported by this method are of type AbstractMesh. In this case, I tried to export the scene to a .babylon format using SceneSerializer. However, the exported file contains geometry information, but the meshes array is empty.
I found that the mesh objects I created separately can be recognized and exported by SceneSerializer to JSON, but AbstractMesh objects cannot. How can I convert AbstractMesh to Mesh, or how can I configure SceneSerializer to recognize AbstractMesh? I checked the documentation but couldn’t find relevant information.

Running this playground will immediately download a scene.json file. Inside, you’ll find that the meshes value only contains the newly created plane, while the imported model is missing.

Thanks!

Hello and welcome!

Seems that you missed await when ImportMeshAsync
Please check this example - https://playground.babylonjs.com/#TSW1VR#3

1 Like

Thank you so much! I’ve been looking for a long time, and I didn’t expect the issue to be here!

1 Like