I have a project that utilizes react-babylon. I recently updated react and all babylon related packages and I’m seeing some strange errors.
For example I am getting this error
Uncaught TypeError: mesh.getMeshUniformBuffer is not a function
at StandardMaterial.bindForSubMesh (standardMaterial.js:1094:1)
at Mesh.render (mesh.js:1641:1)
at SubMesh.render (subMesh.js:300:1)
at RenderingGroup._RenderSorted (renderingGroup.js:202:1)
at RenderingGroup._renderOpaqueSorted (renderingGroup.js:148:1)
at RenderingGroup.render (renderingGroup.js:97:1)
at RenderingManager.render (renderingManager.js:118:1)
at Scene._renderForCamera (ellipse.js:16:1)
at Scene._processSubCameras (ellipse.js:41:1)
at Scene.render (grid.js:95:1)
When I trace this in the dev tools I see that the mesh exists, but for some reason is missing the property getMeshUniformBuffer that it should have as defined in AbstractMesh
Here are my related packages
Before update:
"@babylonjs/core": "^4.2.1",
"@babylonjs/gui": "^4.2.1",
"@babylonjs/loaders": "^4.2.1",
"react": "^17.0.2",
"react-babylonjs": "^3.0.31",
After update:
"@babylonjs/core": "^5.33.0",
"@babylonjs/gui": "^5.33.0",
"@babylonjs/loaders": "^4.2.2",
"react": "^18.2.0",
"react-babylonjs": "^3.1.13",
I am using an .obj model and rendering it like this
import '@babylonjs/loaders/OBJ'
import { Model } from 'react-babylonjs'
return <Model rootUrl={url} sceneFilename={name} onModelLoaded={loadComplete}/>
And this worked perfectly in the old package versions.
I’ve only done a bit of diving into the source to try and figure this out, maybe has something to do with the OBJ loader?
I was hoping someone could provide some insight into why this is happening, happy to provide additional information. Thanks!