[SOLVED] Batch and findByTag

Hello, i used till now a findByTag instruction to disable objects all together, now i have used the batch groups on the trees of my game, but when they have to be disabled (using findByTag) sometime they keep showing. Its a batch groups issue? (i didn’t change anything that involve the trees). Thanks

1 Like

Hi. Do you hide objects by tag during initialization or at runtime?

Yeah I noticed the same problem with batching, except that objects would not show up at runtime when they were supposed to.

Ouch. Any way to reproduce?

Disabling / enabling entities will require the batch to be rebuilt (which is slow). Ideally you should not be doing this during the main game loop. Rebuilding a batch during a frame will likely lead to dropped frames.

That said, arguably we should dirty the batch if you disable an entity in that batch and automatically force a rebuild. (Which would solve your problem, but could lead to dropped frames)

1 Like

Yeah, for now after disabling/enabling stuff you can call app.batcher.generate(), but it can be slow. So ideally don’t make individually hideable objects to be part of the batch.

So in my scene (here) I’ve enabled batching on most of the posters, most of the tanks, and all of the TVs. When I run the scene, none of the batched objects are rendered, so in my build I had to disable it.

I will have to disable it as well since the i batched all the trees and some of them don’t show when suposed to and are shown when shouldn’t. Note: i enable and disable them all together.

That seems to be a bug related to using “static” checkbox with batching at the same time. I merged fix to the engine, so should be updated soon.

1 Like

Ah, thank you very much.