Batching Code changes from 1.43 to 1.44+

When helping a user with updating their project from 1.21 to the latest, there were some code API changes to the batching classes.

In 1.44.0, pc.Batch.model was removed.

So the following code no longer runs as batch.model is undefined.

this.app.batcher.scene.layers.getLayerById(pc.LAYERID_WORLD).addMeshInstances(batch.model.meshInstances);

The fix for this is to use meshInstance instead like so:

this.app.batcher.scene.layers.getLayerById(pc.LAYERID_WORLD).addMeshInstances([batch.meshInstance]);
2 Likes

Note that normally this is handled internally by the batcher, and no change is needed on your part. This is a special case where you manage some of the functionality batcher does yourself.

1 Like