AssetsManager meshTask.onSuccess() is not a function

assets.meshes.forEach(mesh => {
		const meshTask = assetsManager.addMeshTask(mesh.name, mesh.name, mesh.path, mesh.package +".babylon");
		meshTask.onSuccess(task => {
				const loadedMesh = task.loadedMeshes[0];
		}
});

Any thoughts on why it would be saying that this is not a function? I feel like I’m using it the same way as every example I find from the documentation…

onSuccess is not a function but a field holding the success callback function.

you should use it this way:

meshTask.onSuccess = (task) => {
	const loadedMesh = task.loadedMeshes[0];
};
2 Likes