Uncaught TypeError: SceneUtils.createMultiMaterialObject is not a constructor

I’m trying to update to the latest version 131 from 126… Im getting an error though:

Uncaught TypeError: SceneUtils.createMultiMaterialObject is not a constructor

Here is my code. It works in v126, but not when updating to latest v131.

<script type="module">

		import * as THREE from './build/three.module.js';
		import {OBJLoader} from './examples/jsm/loaders/OBJLoader.js';
		import {MTLLoader} from './examples/jsm/loaders/MTLLoader.js';
		import {FBXLoader} from './examples/jsm/loaders/FBXLoader.js';
		import {GLTFLoader} from './examples/jsm/loaders/GLTFLoader.js';
		import {GLTFExporter} from './examples/jsm/exporters/GLTFExporter.js';
		import {OrbitControls} from './examples/jsm/controls/OrbitControls.js';
		import {TransformControls} from './examples/jsm/controls/TransformControls.js';
		import {SceneUtils} from './examples/jsm/utils/SceneUtils.js';
		import {BufferGeometryUtils} from './examples/jsm/utils/BufferGeometryUtils.js';
		
		import * as easing from './js/easing.js';
		
		window.THREE = THREE;
		window.OBJLoader = OBJLoader;
		window.MTLLoader = MTLLoader;
		window.FBXLoader = FBXLoader;
		window.GLTFLoader = GLTFLoader;
		window.GLTFExporter = GLTFExporter;
		window.OrbitControls = OrbitControls;
		window.TransformControls = TransformControls;
		window.SceneUtils = SceneUtils;
		window.BufferGeometryUtils = BufferGeometryUtils;
		
		window.easing = easing;
	</script>

the error happens here:

this.mesh = new SceneUtils.createMultiMaterialObject( this.geometry,[material[0].texture,material[0].flat,material[0].wireframe,material[0].hoverWireframe]);

Why does it work in v126 and not v131… Is it because of the es6?
What do I need to change to my code to get it working?

I’m using NW.js, if that is important to mention.

The new keyword should not be used to call createMultiMaterialObject in either r126 or r131 — the method is not a constructor. I think this didn’t cause an error before r128 because three.js hadn’t yet upgraded to modern ES6 Classes for this code. See: Examples: Convert utils to ES6. by Mugen87 · Pull Request #21611 · mrdoob/three.js · GitHub.

Thanks, that fixed it :slight_smile:
I’m not that familiar with all the technical stuff- I just have learned through trial and error. I’ll try to look into that.