Batch groups on scene changes

Hello,

On scene changes batch groups disappears. Even I try to generate and update functions for batches, changes doesn’t show up and I can’t see scene correctly when I load it from another scene.

Is there any way to re-generate batches?

Hi @commention,

It is easy to generate or regenerate all or part of the batches stored in the batch manager.

Something like this should do:

this.app.batcher.generate();

Take a look at the docs on how this method works, it can also generate batches for specific group/groups only:

https://developer.playcanvas.com/en/api/pc.BatchManager.html#generate

1 Like

Hello Leonidas,

Thank you for your quick response, unfortunately this method doesn’t do anything specifically on scene changes. My project is private at the moment and to setup it, I need to install a server, so I can’t demonstrate it now, but after scene change this method can’t generate batches.

Do you know any other way, like workaround or something that I can hack to make it work?

I believe in that, on first scene it doesn’t create batch group that is needed and in second scene it’s unable to generate them because they don’t exist.

Now this requires some debugging to find out what is the cause.

Normally when an entity is enabled and has a model component with a batchGroupId it will be automatically added to the batcher. To be queued for batching when the time comes.

Try debugging the this.app.batcher in the console to see if groups exists and if each group holds references to entities (I think that would be a private array property named _obj or something).