Is it possible to batch sprites?

I am trying to batch 4000 sprites that all use the same material to use only 1 draw call instead of 4000.

I am unable to do this on the component, but would I be able to in code?

Something like:

var spriteBatch = pc.BatchManager.addGroup(“sprites”,true,100);
var batchObj = pc.BatchManager.prepare(mySpriteEntityArray,true, 100);
pc.BatchManager.create(batchObj,true, 100);

Currently when batches are made the order in which the draw calls are added is fairly arbitrary. This means that it doesn’t work well for transparent geometry like sprites which have to be rendered in a specific order.

There is a batchGroupId property on the sprite component which enables the creation of batches, but as I said, the behavior is a little random at the moment so we’ve disabled it in the interface.