I’m using SceneLoader.LoadAssetContainerAsync() to load assets (via GLTF loader), which I can then add and remove from the scene using container.addAllToScene(), etc. This works great!
…UNLESS the GLTF file uses instances. The GLTF loader faithfully creates InstancedMesh objects in that case, which causes many warnings to be thrown to the console due to InstancedMesh not being a recognized node type here: Babylon.js/packages/dev/core/src/assetContainer.ts at ff6116de83b5db8a87d5680d7156ce8ad647f093 · BabylonJS/Babylon.js · GitHub
Due to this, the _isValidHierarchy() fails upon calling addAllToScene(). Aside from that, it looks like InstancedMesh should be supported in an AssetContainer.
As a workaround I’m setting loader.createInstances = false in the GLTF loader. But it would be nice to take advantage of instancing AND have an AssetContainer.
Perhaps I’m missing something here. Thanks for any help you can give!
- David